I am having other issues too, i will connect with details.
[quote=“RachnaJain, post:1, topic:48329, full:true”]
In powerbi
I have a table which has cols–articlecode, MRINDate, netprice , masternetprice.
I have sorted the table on articlecode( ascending) and MRINDate ascending , as 1 articlecode can have 1 or more MRINdateusing powerquery
Its sorted , but when i use this table in visulization, MRINDate is not coming in sorted order
I have to create price history
Sorted data in table looks like this
Articlecode netprice mrindate
1-10-11 23.00 21 jan 2022
1-10-12 24.00 21 jan 2022
1-10-12 24.00 3 feb 2022
1-10-12 23.00 4mach2022
1-10-12 26.00 6mrch2022
1-10-13 0.23 21jan2022
But in visulization its coming
1-10-11 23.00 21 jan 2022
1-10-12 24.00 3feb2022
1-10-12 24.00 21jan2022
1-10-12 23.00 6mach2022
1-10-12 26.00 4mrch2022
1-10-13 0.23 21jan2022
Another issue to be solved in the following table
I am having other issues too, i will connect with details.
[quote=“RachnaJain, post:1, topic:48329, full:true”]
In powerbi
I have a table which has cols–articlecode, MRINDate, netprice , masternetprice.
I have sorted the table on articlecode( ascending) and MRINDate ascending , as 1 articlecode can have 1 or more MRINdateusing powerquery
Its sorted , but when i use this table in visulization, MRINDate is not coming in sorted order
I have to create price history
Sorted data in table looks like this
Articlecode netprice mrindate masterunpr
1-10-11 23.00 21 jan 2022 24
1-10-12 24.00 21 jan 2022 12
1-10-12 24.00 3 feb 2022 11
1-10-12 23.00 4mach2022 12
1-10-12 26.00 6mrch2022 24
1-10-13 0.23 21jan2022 .24
For thistable sorted by articlecode and podate i want 3 more columns
Prevnetprice, pricechange and podateofchange
Where
- if 1 row for articlecode
Prevnetprice=
Masterunprice
And if more rows
Then prevnetprice = netprice- ( value of netprice in previous row)
- if there is price change then
Podateofchange= currentpodate
Pricechange= either+or- and the value difference
I am unable to store prevnetprice when multiple rows of an articlecode
I have tried dax
VAR CurrentArticleCode = [ArticleCode]
VAR CurrentMRINDate = [MRINDate]
VAR PreviousRow =
CALCULATETABLE(
FILTER(
ALL(SortedTable),
SortedTable[ArticleCode] = CurrentArticleCode
&& SortedTable[MRINDate] < CurrentMRINDate
),
TOPN(1, SortedTable, SortedTable[MRINDate], DESC)
)
VAR NetPriceAtPreviousMRINDate =
IF(
NOT ISEMPTY(PreviousRow),
PreviousRow[NetPrice],
[MasterUnitPrice] – Only one row for ArticleCode
)
RETURN
NetPriceAtPreviousMRINDate
VAR CurrentArticleCode = [ArticleCode]
VAR CurrentMRINDate = [MRINDate]
VAR PreviousRow =
CALCULATETABLE(
FILTER(
ALL(SortedTable),
SortedTable[ArticleCode] = CurrentArticleCode
&& SortedTable[MRINDate] < CurrentMRINDate
)
)
VAR NetPriceAtPreviousMRINDate =
IF(
NOT ISEMPTY(PreviousRow),
EARLIER(PreviousRow[NetPrice]),
[MasterUnitPrice] – Only one row for ArticleCode
)
RETURN
NetPriceAtPreviousMRINDate
Mrindate is podate