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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lucbc
Regular Visitor

Measure and line filter

Hi everyone, i'm new as a Power BI user, so i want you help with this issue:

 

I work at a company that has a campaign happening, which give R$ 1,00 for each product if you sell more than 100 units in the same fiscal note from a specific product, and if you sell any quantity below that, you get R$ 0,50. With that in mind, here is what my report looks like:

lucbc_0-1672430559095.png

It's Name, Quantity of Fiscal note, OLT( Another campaign), Amount of P20( the campaign that i need help), and the last column is the one that is suppose to give me how much money i have to pay. If you look at the lines, the name Thainá P. have 2 sales,  and it makes the right calculations, but when it sums, for some reason, becomes 101, instead of 100,50, and this is a line subtotal. I'll post the P20 column measure, that is for the amount sold, and the last one, that is the one which does the calculation.

P20:

Qtde_P20 = CALCULATE([Qtde Fat], FILTER(ALL(Produtos), (Produtos[Código]Table with the product code) IN {("50010016")}))

Resultado_Geral:
Resultado_Geral= IF(CALCULATE(1,SF2010[Combo]Column to see if there is an OLT+P20 in the same fiscal note= 1) = 1, IF([Qtde Fat] > 99, [Calculo_P20]*2 + [Calculo_OLT],[Calculo_P20]+[Calculo_OLT]), [Calculo_P20] * 2 + [Calculo_OLT] )

Calculo_P20 = CALCULATE([Qtde Fat] * 0.5, FILTER(ALL(Produtos), (Produtos[Código]) IN {("50010016")}))
Calculo_OLT = CALCULATE([Qtde Fat] * 100, FILTER(ALL(Produtos), (Produtos[Código]) IN {("50010014"),("50010017"),("50010001")}))

Qtde Fat = SUM(SD2010[D2_QUANT])

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@lucbc First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8

 

This may also help: Matrix Measure Total Triple Threat Rock & Roll - Microsoft Power BI Community


@ 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...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@lucbc First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8

 

This may also help: Matrix Measure Total Triple Threat Rock & Roll - Microsoft Power BI Community


@ 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...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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