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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tomekm
Helper III
Helper III

Running total formula doesn't work with additional measure placed on Legends

Hello,

 

I have a running total measure for a value for all the months in 2022 that is a combination of the actual values (for jan. to may) and it’s estimated value for future months, and I want to color code the months so that anything present/past is shown in one color (“current”) and anything in the future is a different color (“LE”). For color coding, I created a formula and added it as Legend to show a 2 color distinction between the 2 options. However by doing this, the running total measure in the columns chart just computes Jan to May and then it restarts after May with a running total computed from June to Dec (but only if I leave the color coding formula on Legends. Once it’s removed, the running total works fine). Is there any way to fix the color coding for the running total so that regardless if its labelled as “current” or “LE”, the graph keeps showing the running total for all the months in 2022?

 

Here are my formulas:

 

Running Total =

CALCULATE(

    SUM('Table'[Value]),

    FILTER(

        ALLSELECTED('Table'[Period]),

        ISONORAFTER('Table'[Period], MAX('Table'[Period]), DESC)

    )

)

 

Current vs LE =

IF('Table'[Period]<=TODAY(),"Current", "LE")

 

Any help is much appreciated!

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

Hi, @tomekm ,

Measure can't be used as a legend, only column can be used as a legend, so you can share a simple file and want the output to be displayed, maybe using conditional format.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @tomekm ,

Measure can't be used as a legend, only column can be used as a legend, so you can share a simple file and want the output to be displayed, maybe using conditional format.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@tomekm , Try like

 

Running Total =

CALCULATE(

SUM('Table'[Value]),

FILTER(

ALL('Table'[Period]),

ISONORAFTER('Table'[Period], MAX('Table'[Period]), DESC)

)

)

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Can you share issue screenshot and expected value

Thanks. I tried your formula but it didn't work for me.

But here's the basic sample data that I'm working with, and below are 2 screenshots:

PeriodValue
2022-011200
2022-02390
2022-03570
2022-04443
2022-05831
2022-06590

 

The desired output is the one below. Here I manually adjusted the color for the first 5 periods. But I would like to be able to have this automatically adjusted via a formula, placed on Legend.

 

Capture1.PNG

 

The screenshot below is the wrong output that I currently get when I place my "Current vs LE" formula on Legends:

 

Capture2.PNG

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.