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

Measure Divide by column Value for 12 different month

Hello together,

 

first time posting here, cause i have nobody in my company to ask about power bi and DAX.


I calculated a filtert measure in my table for every month, which works fine, but now i need to divide this Measure for every month by a calculated number of days which come from another created Table. 

SUMX(
FILTER('gf Effort';
'gf Effort'[MonthOfDate] IN {1});
[Gesamtleistung] / CALCULATE([Planarbeitstagesumme];Arbeitstage[MonthOfDate] IN {1}))
 
I can make it work for 1 month, but i dont want to calculate 12 different measure for every month.
So is there a solution to make this DAX expression work for every month, that i get a table or a row with the 12 values?

I'm using direct query for the data, which comes from a sql server.
The 'Arbeitstage' table is created inside power bi and the 'Planarbeitstagesumme' is a calculated Measure from 4 different rows inside the 'Arbeitstage' Table
The [Gesamtleistung] is a calculated Measure to, which filters a row inside the table 'gf effort'
 
Thanks.
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

I found a way to a solution.

 

SUMX('gf Effort'; CALCULATE(SUM('gf Effort'[Revenue]); NOT('gf RevenueType'[Name] IN {"Noch nicht fakturierbare"}))/SUMX(Arbeitstage;Arbeitstage[Planarbeitstagerechnung]))

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

So normally you would have the "month" in the visual and then you could use something like:

 

VAR __Month = MAX('Table'[Month])

RETURN

SUMX(
FILTER('gf Effort';
'gf Effort'[MonthOfDate] __Month);
[Gesamtleistung] / CALCULATE([Planarbeitstagesumme];Arbeitstage[MonthOfDate] = __Month))
 
But really difficult to tell what exactly is going on. 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

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Well that would only give me the result for last Month (12) which is the max number.

 

[Arbeitstage]

MonthOfDateArbeitstageKrankentagePlantage
120119
2220,521,5
321219

 

[gf effort]

MonthOfDate....Revenue
1....10000
2.....7890
1....5000

...

these are my tables.

Now i calculate the [Gesamtleistung] with
Gesamtleistung = CALCULATE(SUM('gf Effort'[Revenue]); NOT('gf RevenueType'[Name] IN {"Noch nicht fakturierbare"}))
 
and this [Gesamtleistung] i want divide by the Plantage row for every Month. 
Like,
1 = 15000/19
2 = 7890/21,5
...

VAR __Month = MAX('Table'[Month])

RETURN

SUMX(
FILTER('gf Effort';
'gf Effort'[MonthOfDate] __Month);
[Gesamtleistung] / CALCULATE([Planarbeitstagesumme];Arbeitstage[MonthOfDate] = __Month))
Only gives me the last one (12) because its the max Month
 
Thanks anyway.
Anonymous
Not applicable

I found a way to a solution.

 

SUMX('gf Effort'; CALCULATE(SUM('gf Effort'[Revenue]); NOT('gf RevenueType'[Name] IN {"Noch nicht fakturierbare"}))/SUMX(Arbeitstage;Arbeitstage[Planarbeitstagerechnung]))

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