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

Consider Different Categories as One to Obtain Cumulative Total

Hello!

 

I am trying to calculate Cumulative Sum for Population against 5 variables. Cumulative Population Sum Issue.PNG

 

 

I was able to get the desired result using a custom measure with out considering variables, 'Month' and 'Week Number'.

 

 

 

Cumulative Population Total = SUMX(SUMMARIZE('Table','Table'[Year],'Table'[County],'Table'[Age ],'Table'[Population]),'Table'[Population])

 

 

 

 

But, I need a Custom Measure, that can take into account all 5 variables (including Month and Week Number) to dynamically calculate Cumulative Population Total based on Filter selections.

 

Any help is highly appreciated!

 

Below is the sample data table used in Power BI Desktop page,

 

YearCountyAge MonthWeek NumberPopulation
2019-2020WashingtonChildJanuary123
2019-2020WashingtonChildJanuary223
2019-2020WashingtonChildFebruary523
2019-2020WashingtonChildFebruary623
2019-2020WashingtonChildMarch923
2019-2020WashingtonAdolescentFebruary530
2019-2020WashingtonAdolescentFebruary630
2019-2020WashingtonAdolescentMarch930
2019-2020WashingtonAdolescentMarch1030
2019-2020KentChildJanuary318
2019-2020KentChildFebruary518
2019-2020KentChildFebruary718
2019-2020KentChildMarch918
2019-2020KentChildMarch1118
2019-2020KentAdultMarch1026
2019-2020KentAdultMarch1126
2019-2020KentAdultApril1326
2019-2020KentAdultApril1426

 

 

Thank you

Nallaa

1 ACCEPTED SOLUTION

Hi , @nallaa 

 From your formula, I didn't find any errors.

If you just want to change the total value of the measure in the table, you can consider using  function"SUMMARIZE"   and "HASONEVALUE"

Cumulative Population_Month and Week Included 2 =
VAR a = [Cumulative Population Total]
VAR b = [Cumulative Population_Month and Week Included]
RETURN
    IF ( HASONEVALUE ( 'Table'[Index] ), b, a )

98.png

You can refer to this related post for more details about measure total level calculation issue.

Measure-Totals-The-Final-Word 

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

I do not understand your question/requirement.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

 

I am sorry that my question is not clear. 

 

My requirement is to calculate Cumulative Total population with a custom measure that includes variables of Year, County, Age, Month, Week.

 

Below is the formula I have used,

 

Cumulative Population_Month and Week Included = SUMX(SUMMARIZE('Table','Table'[Year],'Table'[County],'Table'[Age ],'Table'[Month],'Table'[Week Number],'Table'[Population]),'Table'[Population])
 
The problem with this is formula is that it is considering duplicates under population column. Population values do not change for Month and Week. Population values change by Age, County and Year.

 

I need a formula where I retain all the variables (Year, County, Age, Month, Week) in the custom measure to get 97 as total. 

 

Cumulative Population Sum Issue 3.PNG

 

Hope this clear!

 

Thank you,

Abhinav

 

 

Hi , @nallaa 

 From your formula, I didn't find any errors.

If you just want to change the total value of the measure in the table, you can consider using  function"SUMMARIZE"   and "HASONEVALUE"

Cumulative Population_Month and Week Included 2 =
VAR a = [Cumulative Population Total]
VAR b = [Cumulative Population_Month and Week Included]
RETURN
    IF ( HASONEVALUE ( 'Table'[Index] ), b, a )

98.png

You can refer to this related post for more details about measure total level calculation issue.

Measure-Totals-The-Final-Word 

 

Best Regards,
Community Support Team _ Eason

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