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
patriciahogendo
Frequent Visitor

Need to create a measure for month and/or week and/or day

I want to create a measure which shows the salary per selected month(s) and/or week(s) and/or day(s). My datasheet shows only the salary per person per month.
This measure works for both month and week - I can select multiple months and/or weeks and the result is as expected using this formula:
 
IF
( ISFILTERED ( 'YearMonth Table'[YearMonth]),
IF(
ISFILTERED ( 'Billing Report'[Trigger Week] ),
SUM('Salary 2019'[Salary] ) * DISTINCTCOUNT( 'Billing Report'[Trigger Week] ) / 4,
SUM('Salary 2019'[Salary])
)
)
 
But I also want to add the option to filter on day. But when I add this to the one above, it doesn't work at all anymore.
I created a different formula showing all possible options and it works for a selected day or week, but not for the month anymore:
 
IF
(AND
(AND
(ISFILTERED('Billing Report'[Trigger Month]),
ISFILTERED('Billing Report'[Trigger Week])),
ISFILTERED('Billing Report'[TriggerDateTime])),
DISTINCTCOUNT('Billing Report'[TriggerDateTime] ) * SUM( 'Salary 2019'[Salary] ) / 21 ,
IF
(AND
(ISFILTERED('Billing Report'[Trigger Month]),
ISFILTERED('Billing Report'[TriggerDateTime].[Date])),
DISTINCTCOUNT( 'Billing Report'[TriggerDateTime] ) * SUM( 'Salary 2019'[Salary] ) / 21,
IF
(AND
(ISFILTERED('Billing Report'[Trigger Month]),
ISFILTERED('Billing Report'[Trigger Week])),
DISTINCTCOUNT( 'Billing Report'[Trigger Week] ) * SUM( 'Salary 2019'[Salary] ) / 4 ,
IF
(ISFILTERED('Billing Report'[Trigger Month]),
DISTINCTCOUNT('Billing Report'[Trigger Month]) * SUM( 'Salary 2019'[Salary] ),
IF
(ISFILTERED('Billing Report'[Trigger Week]),
DISTINCTCOUNT( 'Billing Report'[Trigger Week] ) * SUM( 'Salary 2019'[Salary] ) / 4,
IF
(ISFILTERED('Billing Report'[TriggerDateTime]),
DISTINCTCOUNT( 'Billing Report'[TriggerDateTime] ) * SUM( 'Salary 2019'[Salary] ) / 21,
"Shouldn't be possible" )
 
) ) ) ) )
 
Can anybody tell me what I am doing wrong here? Thanks a lot in advance!!
1 ACCEPTED SOLUTION

Thanks! Issue has been solved.

View solution in original post

3 REPLIES 3
Stachu
Community Champion
Community Champion

Can you add sample tables (in format that can be copied to PowerBI) from your model with anonymised data? Like this (just copy and paste into the post window).

Column1Column2
A1
B2.5

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Hi,

Thanks for your reply! As my dataset is quit big, I don't know how to do this.

Could you contact me via Skype (patricia.hogendoorn@damco.com ) so I can show you the whole dataset/dashboard?

Thanks a lot in advance! Patricia

 

Thanks! Issue has been solved.

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.

Top Solution Authors