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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
josuesanchezSA
Frequent Visitor

Missing values in cumulative dax

Hello, 

 

I am trying to get a cumulative total which as you can see below it works, except in period 05 and 09, the totals should be 68 for period 05 and 108 for period 09. Since there were no values found for that period it gives you a zero. Can you please assist. 

Measure 2 = 
var startyear = DATE(2022,10,01)
var enddate = MAX(Table1[Date Entered])-365
return 
IF(CALCULATE(COUNTA('Table1'[ID]),DATESBETWEEN('Calendar'[Date],startyear,enddate))=BLANK()
,0,
CALCULATE(COUNTA('Table1'[ID]),DATESBETWEEN('Calendar'[Date],startyear,enddate)))

josuesanchezSA_1-1720031566307.png

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @josuesanchezSA ,

Based on the description, try the following methods:

Measure 2 = 
VAR startyear = DATE(2023, 01, 01)
VAR enddate = MAX('Table1'[Date]) - 365
VAR CurrentDate = MAX('Table'[Date])
var _period = SELECTEDVALUE(Table1[Month Period])
var result = CALCULATE(
    COUNTA('Table1'[ID]),
    FILTER(
        ALL('Table'),
        'Table'[Date] <= CurrentDate
            && 'Table'[Date] >= startyear
            && 'Table'[Date] < enddate
    )

)
RETURN
IF(ISBLANK(result) || _period > 9, 0 , result)

vjiewumsft_1-1722926933667.png

 

Best Regards,

Wisdom 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

5 REPLIES 5
Anonymous
Not applicable

Hi @josuesanchezSA ,

Based on the description, try the following methods:

Measure 2 = 
VAR startyear = DATE(2023, 01, 01)
VAR enddate = MAX('Table1'[Date]) - 365
VAR CurrentDate = MAX('Table'[Date])
var _period = SELECTEDVALUE(Table1[Month Period])
var result = CALCULATE(
    COUNTA('Table1'[ID]),
    FILTER(
        ALL('Table'),
        'Table'[Date] <= CurrentDate
            && 'Table'[Date] >= startyear
            && 'Table'[Date] < enddate
    )

)
RETURN
IF(ISBLANK(result) || _period > 9, 0 , result)

vjiewumsft_1-1722926933667.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

josuesanchezSA
Frequent Visitor

Hello, 

 

That takes me back where i started, however i do want to say that what is causing this error is that for period 5 there are no values, however, if its its a cumulative total, the result should be 68 not 0

 

josuesanchezSA_0-1720190255016.png

 

josuesanchezSA
Frequent Visitor

Hello @aduguid 

 

The original formula return ineffective results, however i modify this symbol and it turn the following below, still blank fields for period 5.

 

josuesanchezSA_1-1720187043062.png

 

josuesanchezSA_0-1720186962695.png

 

Result below is with original formula you sent:

josuesanchezSA_2-1720187073213.png

 

 

Try this 

CumulativeAmount = 
VAR _start_date = DATE(2022, 10, 01)
VAR _end_date = MAX(Table1[Date Entered]) - 365
VAR _result = 
    CALCULATE(
        COUNT(Table1[ID]) + 0,
        FILTER(
            ALL('Calendar'),
            'Calendar'[Date] <= MAX('Calendar'[Date]) 
            && 'Calendar'[Date] >= _start_date
            && 'Calendar'[Date] < _end_date
        )
    )

RETURN
_result
aduguid
Super User
Super User

Try this measure. I'm assuming your column "Month Period" is coming from your calendar table.

 

CumulativeAmount = 
VAR _start_date = DATE(2022, 10, 01)
VAR _end_date = MAX(Table1[Date Entered]) - 365
VAR _result = 
    CALCULATE(
        COUNT(Table1[ID]),
        FILTER(
            ALL('Calendar'),
            'Calendar'[Date] <= MAX('Calendar'[Date]) 
            && 'Calendar'[Date] >= _start_date
            && 'Calendar'[Date] > _end_date
        )
    )

RETURN
_result

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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