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
camelia_
Frequent Visitor

Cumulative line chart

hiii, currently I am doing cumulative line chart and i want to sort it based on country. But after i use the below measure, what i get is that for all country is the same value. It suppose to have different line and value for each country. Can someone help me figure this out? Thank you so muchh.

And also i need to do a weekly cumulative line chart, can anyone show me the steps on how to do it? thanks in advanceScreenshot (9).png

Screenshot (11).pngScreenshot (12).png

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

The ALL() function removes the country filter context. You need to preserve that filter context to separate countries.

 

I'd probably write the measure something like this:

Cumulative S1 =
VAR _Max = MAX ( Sheet1[Attribute] )
RETURN
    CALCULATE (
        SUM ( Sheet1[Value] ),
        ALLSELECTED ( Sheet1 ),
        VALUES ( Sheet1[COUNTRY] ),
        Sheet1[Attribute] <= _Max
    )

 

Recommended reading:

https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @camelia_ 

 

Have you tried @AlexisOlson 's measure? It should work. 

 

Since you have a Date table in the model, you can add a week column (or a YearWeek column) to it. Then use the week column for the weekly cumulative line chart. 

 

Best regards,

Community Support Team_Jing

AlexisOlson
Super User
Super User

The ALL() function removes the country filter context. You need to preserve that filter context to separate countries.

 

I'd probably write the measure something like this:

Cumulative S1 =
VAR _Max = MAX ( Sheet1[Attribute] )
RETURN
    CALCULATE (
        SUM ( Sheet1[Value] ),
        ALLSELECTED ( Sheet1 ),
        VALUES ( Sheet1[COUNTRY] ),
        Sheet1[Attribute] <= _Max
    )

 

Recommended reading:

https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

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.

Top Solution Authors