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
Anonymous
Not applicable

Total Sum of IF Statement

Hi I am calculating Growth based on two measures and conditions, I am able to see the calculation in the column but am unable get a total of the same column. Any help would be appreciated.

Measure: 

Growth = IF([PY TTM M-1] = 0 && [TTM M-1] > 0, CALCULATE([TTM M-1] - [PY TTM M-1]),0)

11.PNG
 
Thanks!
1 ACCEPTED SOLUTION
Kristjan76
Responsive Resident
Responsive Resident

This is because the measure [PY TTM M-1] = 493.2633.663 in the total row, since this does not equal zero, the if statement returns FALSE, hence = 0.

 

If you want to sum over the Growth then you could do something like this. I did not test this so there might be spelling errors.

 

Growth 2 = 
IF(
  HASONEVALUE([Global Customer Number]),
  [Growth],
  SUMX(  
    ADDCOLUMNS(
      SUMMERIZE(
        myTable,
        myTable[Global Customer Number]
      ),
      "growth val", [Growth]
    ),
    [growth val]
 )

 

View solution in original post

3 REPLIES 3
themistoklis
Community Champion
Community Champion

@Anonymous

 

Put calculate in front of the if statement:

 

 

Kristjan76
Responsive Resident
Responsive Resident

This is because the measure [PY TTM M-1] = 493.2633.663 in the total row, since this does not equal zero, the if statement returns FALSE, hence = 0.

 

If you want to sum over the Growth then you could do something like this. I did not test this so there might be spelling errors.

 

Growth 2 = 
IF(
  HASONEVALUE([Global Customer Number]),
  [Growth],
  SUMX(  
    ADDCOLUMNS(
      SUMMERIZE(
        myTable,
        myTable[Global Customer Number]
      ),
      "growth val", [Growth]
    ),
    [growth val]
 )

 

Anonymous
Not applicable

I tried your solution but I ran into memory issues since my dataset is large. Is there a workaround?

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.