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

Dividing two columns after they have been filtered

Hi,

 

I have looked around the forum and I can't seem to find a satisfying answer on my issue.

 

What I want to do is to visualise my data in a table or something similar:

 

I want to see the following:

 

Plant             Cost Type name                  Difference between WOD and CCC in Internal and Spare parts

Plant a        (Internal + spare parts)         (Sum of WOD/sum of CCC)

Plant b        (Internal + spare parts)         (Sum of WOD/ sum of CCC)

Plant c        (Internal + spare parts)         (Sum of WOD/ sum of CCC)

 

My data looks is somewhat similar to the example below:

 

Plant             Cost Type name                                CCC                         WOD

Plant a            Internal                                            10                                 2

Plant a             External                                           2                                   12

Plant b             Internal                                           1                                    1

Plant b             External                                          4                                     4

Plant b            Spare parts                                     7                                     10

Plant a            Internal                                            4                                    5

Plant a             External                                           3                                   3

Plant b             Internal                                           8                                   9

Plant b             External                                          19                                    5

Plant b            Spare parts                                      3                                    12

Plant c             Internal                                           8                                   2

Plant c             External                                          4                                    5

Plant c            Spare parts                                      3                                    12

 

This is my first post to Power Bi community, so I apologize for the lack of correct lingo and visualisation.

 

I look forward to your answers 🙂

1 ACCEPTED SOLUTION

Hi @Crav888,

 

>>Now I have two Plant A001 rows. I just want one Plant A001 that shows external cost and spare part cost for WOD and divides that with external cost and spare part cost for CC

Remove the 'cost type name' column from the visual and you will get the summary result which you wanted.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @Crav888,

 

Actually you not need to add an external filter on this formula, power bi will auto filter the measure to calculate on current filtered records.

Result = SUM('sample'[WOD])/SUM('sample'[CCC])

4.PNG

 

BTW, when your calculation will break current filters, then you need to add some additional filter in the formula.

 

For example: I want to know the percent of current selected and unfiltered records.

Pecent of current Plant = 
var currentPlant=LASTNONBLANK('sample'[Plant],[Plant])
Return
SUM('sample'[WOD])/SUMX(FILTER(ALL('sample'),[Plant]=currentPlant),[WOD])

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you so much for your help. I can follow some of the logic 🙂

 

However, I want the table to give one result for Plant A, one result for Plant B etc.

 

Plant A: (Summarized Internal WOD + summarized spare parts WOD) / (Summarized Internal CCC + summarized spare parts CC)

Plant B: (Summarized Internal WOD + summarized spare parts WOD) / (Summarized Internal CCC + summarized spare parts CC)

 

Furthermore, I get the same result for all the plants. Not sure how to fix it.

 

Plant Maintenance PPI 1 help.PNG

 

I want something like this:

However, the two columns do not match with the result in the column :S

Capture.PNG

 

That is so great.

 

One last thing - I think.

 

Now I have two Plant A001 rows. I just want one Plant A001 that shows external cost and spare part cost for WOD and divides that with external cost and spare part cost for CC

 

Capture.PNG

 

Is thas possible?

Hi @Crav888,

 

>>Now I have two Plant A001 rows. I just want one Plant A001 that shows external cost and spare part cost for WOD and divides that with external cost and spare part cost for CC

Remove the 'cost type name' column from the visual and you will get the summary result which you wanted.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @Crav888,

 

My formula is measure, if you direct put it as calculated column, it will get the static value of all table.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.