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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Nidhi9392
New Member

Line graph and running total

1000059445.jpg

 so the above graph is a clustered column chart .i don't ve data after march_24 and the line graph is showing straight line that is making sense .i want to show the line graph (one in green) till the month I have data . What dax should I use here 

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

Hi, @Nidhi9392 

Based on your description, you can try the following Measure to solve your problem.

vyaningymsft_0-1714113165171.png

MinDateForMaxLine2 = 
VAR MaxLine2 =
    MAX ( 'Table'[line2] )
VAR _maxline2 =
    CALCULATE ( MAX ( 'Table'[line2] ), ALL ( 'Table' ) )
VAR _result =
    MINX ( FILTER ( ALL ( 'Table' ), 'Table'[line2] = MaxLine2 ), 'Table'[date] )
VAR _filter =
    IF (
        SELECTEDVALUE ( 'Table'[date] ) > _result
            && SELECTEDVALUE ( 'Table'[line2] ) = _maxline2,
        0,
        1
    )
VAR _sumLine2 =
    CALCULATE (
        SUM ( 'Table'[line2] ),
        FILTER ( 'Table', _filter = 1 && 'Table'[line2] <> 0 )
    )
RETURN
    _sumLine2


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.

If this does not work, could you please share some sample data without sensitive information and expected output.

If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum




View solution in original post

1 REPLY 1
v-yaningy-msft
Community Support
Community Support

Hi, @Nidhi9392 

Based on your description, you can try the following Measure to solve your problem.

vyaningymsft_0-1714113165171.png

MinDateForMaxLine2 = 
VAR MaxLine2 =
    MAX ( 'Table'[line2] )
VAR _maxline2 =
    CALCULATE ( MAX ( 'Table'[line2] ), ALL ( 'Table' ) )
VAR _result =
    MINX ( FILTER ( ALL ( 'Table' ), 'Table'[line2] = MaxLine2 ), 'Table'[date] )
VAR _filter =
    IF (
        SELECTEDVALUE ( 'Table'[date] ) > _result
            && SELECTEDVALUE ( 'Table'[line2] ) = _maxline2,
        0,
        1
    )
VAR _sumLine2 =
    CALCULATE (
        SUM ( 'Table'[line2] ),
        FILTER ( 'Table', _filter = 1 && 'Table'[line2] <> 0 )
    )
RETURN
    _sumLine2


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.

If this does not work, could you please share some sample data without sensitive information and expected output.

If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum




Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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