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

Using Monthly Data for Weekly Calculations

Hello,

 

I'm having difficulty figuring out how to solve my data shortage problem. I have a data set that is calculating the number of new accounts per employees, but my new accounts data is weekly and my employee data is monthly. Naturally , power Bi does the following:

 

Capture.PNG

I'm not sure how to make Power BI read the employee information based on the month and not the week. Please note that the dates are linked to a single master calendar table, but of course Power BI doesn't do weekly breakdowns. Any help is greatly appreciated. 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous here is the output and measure to calculate this

 

parry2k_0-1594151730945.png

 

Measures

Total Accounts = SUM ( Emp[Accounts] )

Emp Count = 
VAR m = MAX ( 'Date'[Month] )
RETURN 
CALCULATE ( 
    SUM ( Emp[Employee Count] ),
    ALL ( 'Date' ), 
    'Date'[Month] = m 
) * 
DIVIDE ( [Total Accounts], [Total Accounts] ) 

Accts/Emp = DIVIDE ( [Total Accounts], Emp[Emp Count] ) 

 

Follow this to add date dimension if you don't have one


https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/

 

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!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

 



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

2 REPLIES 2
parry2k
Super User
Super User

@Anonymous here is the output and measure to calculate this

 

parry2k_0-1594151730945.png

 

Measures

Total Accounts = SUM ( Emp[Accounts] )

Emp Count = 
VAR m = MAX ( 'Date'[Month] )
RETURN 
CALCULATE ( 
    SUM ( Emp[Employee Count] ),
    ALL ( 'Date' ), 
    'Date'[Month] = m 
) * 
DIVIDE ( [Total Accounts], [Total Accounts] ) 

Accts/Emp = DIVIDE ( [Total Accounts], Emp[Emp Count] ) 

 

Follow this to add date dimension if you don't have one


https://perytus.com/2020/05/22/create-a-basic-date-table-in-your-data-model-for-time-intelligence-calculations/

 

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!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

 



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.

Anonymous
Not applicable

@parry2k This solution is so so close! For future reference, I also had to include a variable for the year because my data is spread over multiple years. But there is a weird problem that's also occurring. 

 

It seems like the employee count is randomly taking in the previous month's data. In the example in the picture, the employee count for 2/2/2019 should be 487 not 756. I cannot find a pattern in my data for why this is occurring but it appears throughout my whole dataset, any ideas?

 

Capture.PNG

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.