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
soldstatic
Resolver I
Resolver I

Calculate Sum for Latest Available Date (As of Existing Date)

Can anybody help me wrap my head around the best way to calculate a metric so that it doesn't change for past data over time? Meaning whenever someone looks at the report for past data, it always calculates the same?

 

The KPI is Customer Interruptions / Customers Served. I'm using the following measures:

Customers Measure = 
CALCULATE(
    SUM('TableServedByDate'[Premises])
    ,LASTDATE('TableServedByDate'[CALENDAR_DATE])
)


KPI = sum('EventList'[CI])/[Customers Measure]

The problem is the total is using the Customers Measure with the latest count, it isn't summing up each of the previous entries. Meaning if I look at the whole year, it sums up the CI just fine but it divides by say December's customer count. It looks good on a month by month view, since I only get the Premises data once a month, but I want to use this count for wherever it's applicable but then NOT recalcualte it afterwards. Does that make sense?

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @soldstatic 

This looks like a measure totals problem. Very common. See this 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

 

If not your case, please share some sample data and expected out.

 

Best Regards,

Lin

Community Support Team _ Lin
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

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

hi, @soldstatic 

This looks like a measure totals problem. Very common. See this 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

 

If not your case, please share some sample data and expected out.

 

Best Regards,

Lin

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

OK so those posts really helped me for scaling up in time, ie going from month to year etc. However, I'm struggling to adapt it to the other direction. Meaning: I need to use the most recent customer count available, even if there isn't one joined on this particular date.

The date table and the customer count table are joined on calendar_date, because I might get a count on the 1st of the month or I could get a count on the 15th, or every day of the month. So what we want to do is use the most recent count as of the date_table date (which is what is on the axis of the visualizations).

 

So basically this is what I'm getting right now for the measure above and I need to fill in the gaps:

 

YearMonthCALENDAR_DATECustomer Measure
201611/1/2016 0:0034991
201611/3/2016 0:00 
201611/4/2016 0:00 
201611/6/2016 0:00 
201611/7/2016 0:00 
201611/9/2016 0:00 
201611/10/2016 0:00 
201611/11/2016 0:00 
201611/12/2016 0:00 
201611/13/2016 0:00 
201611/14/2016 0:00 
201611/18/2016 0:00 
201611/19/2016 0:00 
201611/20/2016 0:00 
201611/23/2016 0:00 
201611/25/2016 0:00 
201611/28/2016 0:00 
201611/29/2016 0:00 
201611/30/2016 0:00 
201622/1/2016 0:0035001
201622/2/2016 0:00 
201622/3/2016 0:00 
201622/4/2016 0:00 
201622/7/2016 0:00 
201622/8/2016 0:00 
201622/9/2016 0:00 
201622/10/2016 0:00 
201622/11/2016 0:00 
201622/12/2016 0:00 
201622/13/2016 0:00 
201622/14/2016 0:00 
201622/15/2016 0:00 
201622/16/2016 0:00 
201622/17/2016 0:00 
201622/18/2016 0:00 
201622/20/2016 0:00 
201622/22/2016 0:00 
201622/23/2016 0:00 
201622/24/2016 0:00 
201622/26/2016 0:00 
201622/28/2016 0:00 
201622/29/2016 0:00 

hi, @soldstatic 

Do you mean that you want fill in every month? If so, you could try TOTALMTD Function.

If you still have the problem, please share some some sample data and expected output as below:

Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Best Regards,

Lin

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

Thanks! Sometimes I just don't know what to search for, I appreciate the help. Looks like this should get me on the right track. I might come back if I can't figure it out though 😉 lol

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.