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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count IF statement Annualization

I have a measure that creates a cumulative running total for revenue. 

Cumulative Total= 

CALCULATE (
    SUM ( 'Sales Table'[Revenue] ),
    FILTER (
        ALL ( 'DIM_DATE' ),
        'DIM_DATE'[DATE_ACTUAL] <= MAX( ( 'DIM_DATE'[DATE_ACTUAL] )
    )
))
 
I have another measure that uses an IF statement to see if a customer is new or not. 
If Measure =
VAR CumulTot= [Cumulative Total MEASURE]
VAR preCumulTot= [CumlTotalPreviousMonth]
VAR Result= IF(CumulTot<>0 && preCumulTot=BLANK(), 1,0)

RETURN
Result
 
I have a measure that correctly takes the sum if viewed in "Month Year" format, but if I view in Qtr or Yr format, the counts are off.
I assume the counts are off based on the IF statement , but I am unsure how to go abt it to get accurate counts in each Date Hiearchy view?
 
The calc to sum the If Measure is 
If Measure Sum= SUMX(CALCULATETABLE(VALUES(Customer Table[Customer Name]),ALL(DIM_DATE[Month Year],DIM_DATE[YEAR_MONTH_NUM]),DIM_DATE[Year Month order]), [If Measure])
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous ,

Try  changes in the measure

If Measure =
VAR CumulTot= [Cumulative Total MEASURE]
VAR preCumulTot= [CumlTotalPreviousMonth]
VAR Result= IF(not(Isblank(CumulTot))  && isblank(preCumulTot), 1,0)

RETURN
Result

 

Seem like the same approach as

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529
Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

For some reason that works for the cumulative total but not the reverse. 

 

Reverse= CALCULATE (
    SUM ( 'Sales'[Revenue] ),
    FILTER (
        ALL ( 'Date'[DATE] ),
        'Date'[DATE] >= MIN( ( 'Date'[DATE] )
    )
))
 
I would like to use the same formula for the reverse measure, but this one does not count my totals correctly. I would like to do the same month over month calculation . IF (rev)=blank && (previousmonth rev)<>0, 1,0
 
Any idea?
amitchandak
Super User
Super User

@Anonymous ,

Try  changes in the measure

If Measure =
VAR CumulTot= [Cumulative Total MEASURE]
VAR preCumulTot= [CumlTotalPreviousMonth]
VAR Result= IF(not(Isblank(CumulTot))  && isblank(preCumulTot), 1,0)

RETURN
Result

 

Seem like the same approach as

Customer Retention Part 1:
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529
Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.