Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

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


Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.