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

Converting Aggregated data to Daily

I am doing some analysis on Covid 19 cases .  The problem is my data set does not show new cases each day but the  total cases accumulated to date.  To Identify the incremental increase in cases each day I created the meausure below . The measure works in some rows but  in certain rows it does not work.  for example the increase was not calculated as shown in the table below when cases increased from 59 - 60 or from 60 - 61 and there are many other instances when this occurs. Any one have thoughts on what is taking place here?

 

Today Cases =
MAX('Daily Covid -19 Tracker'[Sum of total_cases]) -
CALCULATE(MAX('Daily Covid -19 Tracker'[Sum of total_cases]), FILTER(ALL('Daily Covid -19 Tracker'), 'Daily Covid -19 Tracker'[date] = MAX('Daily Covid -19 Tracker'[date]) -1) )
 
 
 

Covid Cases 1.png

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous try changing MAX to SUM, maybe there are two transactions on the same day

 

Today Cases =
SUM('Daily Covid -19 Tracker'[Sum of total_cases]) -
CALCULATE(SUM('Daily Covid -19 Tracker'[Sum of total_cases]), FILTER(ALL('Daily Covid -19 Tracker'), 'Daily Covid -19 Tracker'[date] = MAX('Daily Covid -19 Tracker'[date]) -1) )

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Anonymous try changing MAX to SUM, maybe there are two transactions on the same day

 

Today Cases =
SUM('Daily Covid -19 Tracker'[Sum of total_cases]) -
CALCULATE(SUM('Daily Covid -19 Tracker'[Sum of total_cases]), FILTER(ALL('Daily Covid -19 Tracker'), 'Daily Covid -19 Tracker'[date] = MAX('Daily Covid -19 Tracker'[date]) -1) )

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

az38
Community Champion
Community Champion

@Anonymous 

why don't you use solution from here https://community.powerbi.com/t5/Desktop/Converting-daily-aggregated-COVID-data-to-an-accurate-Monthly/m-p/1130871#M515300 ?

the problem your data is more complicated, you have many different columns, use

Today Cases =
CALCULATE(SUM('Daily Covid -19 Tracker'[Sum of total_cases]), ALLEXCEPT('Daily Covid -19 Tracker', 'Daily Covid -19 Tracker'[Date]) ) -
CALCULATE(SUM('Daily Covid -19 Tracker'[Sum of total_cases]), FILTER(ALL('Daily Covid -19 Tracker'), 'Daily Covid -19 Tracker'[Date] = MAX('Daily Covid -19 Tracker'[Date]) -1) )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

@az38  I used a different data source. and although your original post helped me with my original data set it responsed differently to the new data. Thank you for your help

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.