The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
With the following data, I want to show on a continuous line chart the value per SKU during september. It's a stock value so basicaly, between the 25/09 and 29/09 for the SKU A, I want the value to remain at 8 (before a drop to 3 the 29/09).
So I don't want blank value to be 0, I would like to get the previous value if blank.
Date | SKU | Index | Value |
29-sept | A | 1 | 3 |
25-sept | A | 2 | 8 |
19-sept | B | 3 | 9 |
18-sept | A | 4 | 1 |
06-sept | B | 5 | 3 |
01-sept | B | 6 | 0 |
Thank you for your help !! Best regards
Marie
Solved! Go to Solution.
HI @malataix,
Did these blank parts real include in your table records? If that is the case, you can check the current value if it equal to zero and use expression to look up the previous data values.
If the blank part means record not existed in table, you may need to use a new calendar table date field as axis and write measure expression to lookup current table to get previous result.
formula =
VAR currDate =
MAX ( DateTable[Date] )
VAR exist =
CALCULATE (
COUNTROWS ( Table1 ),
FILTER ( ALLSELECTED ( Table1 ), [Date] = currDate ),
VALUES ( Table1[SKU] )
)
VAR prevDate =
CALCULATE (
MAX ( Table1[Date] ),
FILTER ( ALLSELECTED ( Table1 ), [Date] < currDate )
)
RETURN
IF (
exist > 0,
SUM ( Table1[Value] ),
CALCULATE (
SUM ( Table1[Value] ),
FILTER ( ALLSELECTED ( Table1 ), [Date] = prevDate ),
VALUES ( Table1[SKU] )
)
)
Regards,
Xiaoxin Sheng
HI @malataix,
Did these blank parts real include in your table records? If that is the case, you can check the current value if it equal to zero and use expression to look up the previous data values.
If the blank part means record not existed in table, you may need to use a new calendar table date field as axis and write measure expression to lookup current table to get previous result.
formula =
VAR currDate =
MAX ( DateTable[Date] )
VAR exist =
CALCULATE (
COUNTROWS ( Table1 ),
FILTER ( ALLSELECTED ( Table1 ), [Date] = currDate ),
VALUES ( Table1[SKU] )
)
VAR prevDate =
CALCULATE (
MAX ( Table1[Date] ),
FILTER ( ALLSELECTED ( Table1 ), [Date] < currDate )
)
RETURN
IF (
exist > 0,
SUM ( Table1[Value] ),
CALCULATE (
SUM ( Table1[Value] ),
FILTER ( ALLSELECTED ( Table1 ), [Date] = prevDate ),
VALUES ( Table1[SKU] )
)
)
Regards,
Xiaoxin Sheng
Any help ? thank
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
94 | |
93 | |
88 | |
70 | |
65 |
User | Count |
---|---|
231 | |
127 | |
117 | |
82 | |
82 |