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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MTTsoftwareuser
Frequent Visitor

DAX Filtering on a Column (Twice) and then Dividing the Related Data from Other Columns

Amongst my table I have Columns that include [Has WO], [Multiple WO], and [Hours].  I want to find all of my records where [Has WO] = "YES" and divide those records where [Has WO] = "YES" and [Multiple WO] = "Multiple" but I want to divide the [Hours] that are associated with the first filter by the [Hours] associated with the second filter.  So, let's say there are 20 records that satisfy the first condition and 80 that satisfy the second condition - the result shouldn't be (or likely won't be) 25% because the 20 records might have 102 hours associated and the 80 records might have 405 hours - I want the 102/405.  I came up with this but I don't think it is working...

 

Chart 4b = DIVIDE(
CALCULATE(
SUM ('Data'[Hours]),
FILTER (Data,Data[Has WO] = "YES")),
CALCULATE(
SUM ('Data'[Hours] ),
FILTER (Data,'Data'[Has WO] = "YES" && (Data[Multiple WO] = "MULTIPLE")
)
))
 
Thanks!
6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

What exact problem are you facing?  Also, your formula can be simplified to:

Chart 4b = DIVIDE(CALCULATE(SUM ('Data'[Hours]),Data[Has WO] = "YES"),CALCULATE(SUM ('Data'[Hours]),'Data'[Has WO] = "YES",Data[Multiple WO] = "MULTIPLE"))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

My source chart done through Excel generated this correctly

MTTsoftwareuser_0-1682234665467.png

My Power BI chart looks like this

4a.jpg

Hi,

In the Formatting pane, edit the Y axis intervals/numbers


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks - but nothing here is changing the result...

 

c4.png

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hmm how do I attach a file here?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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