Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
malataix
Frequent Visitor

Continous line chart, previous value for blank data

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.

DateSKUIndexValue
29-septA13
25-septA28
19-septB39
18-septA41
06-septB53
01-septB60


Thank you for your help !! Best regards
Marie

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
malataix
Frequent Visitor

Any help ? thank

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.