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
andy_scott42
Helper II
Helper II

Summing data with different date frequencies

I have some sales data from a Snapshot Fact tale aggregating some sales data for different sites.

 

However, the frequency of the data I receive from the sites is different i.e. some are daily and some are weekly. See below example:

 

andy_scott42_0-1613146287807.png

On the 22nd I recieved sales data from Sites D,E,F,G and H making a total of 8248.

 

How can I include the weekly sales in the future dates until the next weekly data comes in. For example I want to display 8335 (G13 in the photo) as my total sales for the 23rd.

 

I tried writing a cumulative sum in dax but I still ended up with a line like this 

andy_scott42_1-1613146586107.png

Also the data already is cumulative as its from a Snapshot Fact table.

 

Thanks

1 ACCEPTED SOLUTION
andy_scott42
Helper II
Helper II

The solution I came up with was to add a Row Number to the data based on WeekDay desc, so for each site I could filter to show the latest data per site per week. I then changed the axis of my chart to weekly, showing the first date of each week.

View solution in original post

7 REPLIES 7
andy_scott42
Helper II
Helper II

The solution I came up with was to add a Row Number to the data based on WeekDay desc, so for each site I could filter to show the latest data per site per week. I then changed the axis of my chart to weekly, showing the first date of each week.

VijayP
Super User
Super User

@andy_scott42 

Calculate(MAX(amount),all(Table),Values(Site)) Try this




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


VijayP
Super User
Super User

@andy_scott42 

Calculate(sum(sales),Filter(All(DateDim),DateDim[Date]<=MAx(DateDim[Date]))

This measure will give the cumulative effect. you need to create a Date Dimension Table and connect with FAct Table with DAte. 

How to Create a Date Table - https://www.youtube.com/watch?v=C3ckN6LN6xo

Watch the video




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Thanks for the speedy reponse Vijay but just doing a cumulative sum doesn't meet the requirement as the data is already aggregated daily. Your solution double counts the number of sales.

negi007
Community Champion
Community Champion

@andy_scott42  Since you have date in your table, you can easily create a week column. So when you get daily data it will have the date for that day and for weekly sales you put the sales number under any of the day during the week. This way your weekly column will help you in giving you weekly sales total which you are chasing in this case. 

 

let me know if it works for you. You can always share your data in text or powerbi format to assist you better.




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Thanks. I added a FirstOfWeek column from my date dimension but it summed up all the values for the week. As the data is already aggregated in the snapshot Fact all I really need is the max value for each site per week.

Hi @andy_scott42 ,

 

Could you pls advise me how to get the result of 8335?BTW,could you paste your data and copy it here rather than showing the screeshot?

I would try my best to find the solution you need.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

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.