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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Get sum of calculated measures

Hi,

 

I've been struggling with this problem for weeks now, really need some help to sort it out.

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Get-end-of-the-selected-month-in-a-column/m-p...

 

I have a dynamically calculated measure [Aged Tickets Days] based on month selection. Then I added another measure [aged_total] to get the total number of tickets that are older than 30 days. 

I was able to give 1 value to the rows that are over 30 in Aged tickets days. but as you may know, Power Bi is not very supportive in terms of getting totals of measure.

 

 

aged_total = 
var aged =  IF([Aged Tickets Days] > 30, 1, BLANK())
return IF(HASONEFILTER('All Tickets'[ID]),
   aged,
    SUMX(FILTER('All Tickets', [Aged Tickets Days] > 30), aged)
)

 

 

Capture.PNG

So I searched to find the solution but haven't been able to resolve it. 

https://www.youtube.com/watch?v=Ka7Ds4EAjNQ

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

 

Looks like these tricks only work when calculating column not measure. 

 

Please look at my sample file, advise if I'm doing something wrong.

 

Sample data 

Thank you so much for your help!

10 REPLIES 10
amitchandak
Super User
Super User

@Anonymous , Try like

aged_total = 
var aged =  IF([Aged Tickets Days] > 30, 1, BLANK())
return IF(HASONEFILTER('All Tickets'[ID]),
   aged,
    SUMX(values('All Tickets'[ID]), aged)
)
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
Anonymous
Not applicable

Hi @amitchandak ,

 

Thanks for the reply. 

I've tried it but it returns all tickets created in the selected month, not the tickets over 30 days. 

@Anonymous This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
SumScoreMeasure = SUMX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])

etc.

 

You should be able to combine that with the technique shown here: 

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks for commenting @Greg_Deckler 

 

I've tried your methods at a very early stage but it didn't work. 

I assume SUMX doesn't work well with a dynamically calculated measure.

 

Here is the sample data that I'm struggling with in case you want to have a look.

https://drive.google.com/file/d/1iNbfYCKafi4jVbtNrGHhCmhP6aC44Fky/view?usp=sharing

 

Thank you for your help!

@Anonymous , I think a formula like this should work.

 

sumx(Values(Table[ID]) ,if( datediff(max(Created date]), selecteddate(Date[Date]),Day) >30 && isblank(Table[Closed Date]),1,0))

 

Do you need a bucket on top of it?

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

@amitchandak There is a sample data link available in my original post.

Here is the link  https://drive.google.com/file/d/1iNbfYCKafi4jVbtNrGHhCmhP6aC44Fky/view?usp=sharing

Thank you so much for your help. 

lbendlin
Super User
Super User

Your "Aged Tickets Days" measure seems inconsistent.

 

lbendlin_0-1600045584515.png

 

Please confirm that is intended.

 

In general it helps to compute totals by themselves, not involving other measures.

 

like so:

 

aged total2 := sumx('All Tickets',if(DATEDIFF('All Tickets'[Created Date],'All Tickets'[Closed Date],DAY)>30,1,0))
Anonymous
Not applicable

Thank you @lbendlin for confirming it. 

Yes, it is intended because I want the measure to return different values based on the ticket status. 

e.g.

If a ticket is not closed  -> return not_closed

If a ticket is closed && status='closed' -> return closed

If a ticket is closed && status='resolved' -> return resolved

 

+ Thanks for the suggestion. The problem is I need to check whether tickets are aged at the selected month including not closed ones.

For instance, if I select "May" it should count all tickets that are over 30 days, then 

 

datediff([created date], [closed date], Day)

 

will do the job but I can't get the tickets that are still open because it doesn't have the closed date value yet. 

 

Please let me know if you need more clarification. 

Look again at your Aged Ticket Days measure. It returns closed, ignoring result.

Anonymous
Not applicable

Sorry @lbendlin  my bad, it's been fixed now.

I was trying different things before and forgot to change it back. 

Capture1.PNG

Still, this doesn't change the way it behaves in other measures though. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors