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
The8
Helper II
Helper II

Table Total Incorrect with Measure A using in New Measure

Hi,

I have loaded data into power BI from excel and I have created relationship betweeen tables using currency column.
Sheet 1

The8_1-1712662823600.png

Sheet 2
The8_3-1712662842072.png



Now I have following measures

Final Price in € = DIVIDE(SUM(Sheet1[Price]),SUM('Sheet2'[From € to $ (Conv. Rate)]),0)
Net price = DIVIDE([Final Price in €],SUM(Sheet1[Quantity]),0)

But when I use this measure I have incorrect total values for measure "Net price" as below (I have checked the formats of each column to be in decimal format)
The8_5-1712663175463.png


Any suggestions to solve this ?!

Thanks in advance

@Ashish_Mathur   (May be can you help me regarding this post!)

1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_1-1714694181712.png

 


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

View solution in original post

19 REPLIES 19
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file with your measures already written.  Show the problem and the expected result.


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

Hello @Ashish_Mathur ,

FYI, In the loop of this topic, you can see I already had conversation with other community members but I coudn't able to solve the problem.

Sheet 1:

MaterialDateQuantityPriceCurrency
X101.01.20243086EUR
X201.01.202420177USD
X301.01.20241536EUR
X101.02.20244381EUR
X201.02.202446165USD
X301.02.20243440EUR
X101.03.20242885EUR
X201.03.202446175USD
X301.03.20243235EUR


Sheet 2 :

From € to $ (Conv. Rate)Currency
1,08USD
1EUR



Both this tables are in relationship by column Currency.

Measures:

Final Price in € = DIVIDE(SUM(Sheet1[Price]),SUM('Sheet2'[From € to $ (Conv. Rate)]),0)
Net price = DIVIDE([Final Price in €],SUM(Sheet1[Quantity]),0)

Thanks !!

That does not give me what i requested for in my previuos message.


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

Here are details you requested.

Hello @Ashish_Mathur  ,

Sheet 1:

MaterialDateQuantityPriceCurrency
X101.01.20243086EUR
X201.01.202420177USD
X301.01.20241536EUR
X101.02.20244381EUR
X201.02.202446165USD
X301.02.20243440EUR
X101.03.20242885EUR
X201.03.202446175USD
X301.03.20243235EUR


Sheet 2 :

From € to $ (Conv. Rate)Currency
1,08USD
1EUR



Both this tables are in relationship by column Currency.

Measures:

1.Final Price in € = DIVIDE(SUM(Sheet1[Price]),SUM('Sheet2'[From € to $ (Conv. Rate)]),0)
2.Net price = DIVIDE([Final Price in €],SUM(Sheet1[Quantity]),0)

3.
"Net Price Total Date Material
=
    VAR __Table = SUMMARIZE( 'Sheet1', [Date],[Material],"__Value", [Net Price])
    VAR __Result = IF(HASONEVALUE(Sheet1[Date]), [Net price], SUMX(__Table, [__Value]))
RETURN
    __Result
"

Below is the link to acces the file:
https://drive.google.com/file/d/1tanNNwqShDfjB4L7AID--7MuPl52GBny/view?usp=drive_link

I am expecting right totals as highlighted below.

The8_0-1714648817900.png
The8_1-1714648846384.png
 
Thanks !




Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_1-1714694181712.png

 


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

Access Denied message.


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

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


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

@Greg_Deckler I have already gone through your post and videos but I coudn't able to solve the problem. I coudn't able to get your solution methodology exactly in my scenario.

That would be great if have a solution exactly according to my data. 

Thanks !!

@The8 Cool, please post your data as text and all relevant formulas.


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

Hello @Greg_Deckler ,

Sheet 1

MaterialDateQuantityPriceCurrency
X101.01.20243086EUR
X201.01.202420177USD
X301.01.20241536EUR
X101.02.20244381EUR
X201.02.202446165USD
X301.02.20243440EUR
X101.03.20242885EUR
X201.03.202446175USD
X301.03.20243235EUR


Sheet 2

From € to $ (Conv. Rate)Currency
1,08USD
1EUR



Both this tables are in relationship by column Currency.

Measures:

Final Price in € = DIVIDE(SUM(Sheet1[Price]),SUM('Sheet2'[From € to $ (Conv. Rate)]),0)
Net price = DIVIDE([Final Price in €],SUM(Sheet1[Quantity]),0)

Thanks !!







@The8 See PBIX attached below signature.

 


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

Hello @Greg_Deckler 

 

Is that possible even when I take material into a table or matrix in my case?

Thanks !!

@The8 I don't think that you are taking the time to read up on this issue, particular the second link I posted that goes through the issue in detail and how to fix it. If you include additional columns in your table visual, you have to add those columns to your SUMMARIZE like this:

Final Price Total = 
    VAR __Table = SUMMARIZE( 'Sheet1', [Date],[Material], "__Value", [Final Price in €])
    VAR __Result = IF(HASONEVALUE(Sheet1[Date]), [Final Price in €], SUMX(__Table, [__Value]))
RETURN
    __Result

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

Hi @Greg_Deckler 

I have gone through your posts and I have also tried DAX with material but I got error even though.

The8_1-1713111281051.png

Modified Measure I used is 

"
Net Price Total =
    VAR __Table = SUMMARIZE( 'Sheet1', [Date],[Material], "__Value", [Net Price])
    VAR __Result = IF(HASONEVALUE(Sheet1[Date]), [Net price], SUMX(__Table, [__Value]))
RETURN
    __Result
"

Can you help me regarding this?

Thanks in advance @Greg_Deckler 






The8_0-1713111209032.png

 






@The8 Actually the relationship direction needed to be both and not single direction and that was throwing the numbers off. See updated file.


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

Hi @Greg_Deckler 

Thank you, Good day!

You are exactly right, when we change relationship direction to "both" and adding Material into my measure as below is working absolutely fine even with Material Slicer.

"
Net Price Total Date Material =
    VAR __Table = SUMMARIZE( 'Sheet1', [Date],[Material],"__Value", [Net Price])
    VAR __Result = IF(HASONEVALUE(Sheet1[Date]), [Net price], SUMX(__Table, [__Value]))
RETURN
    __Result"

The8_1-1713165152608.png

 

But when I make slicer selection based on date again I have same problem, totals being wrong as below image for your reference.

With Date SLicer Selection:

The8_0-1713164768986.png
Any changes needs to be done still ?









@The8 That would be:

Net Price Total Date Material =
    VAR __Table = SUMMARIZE( ALLSELECTED('Sheet1')[Date],[Material],"__Value"[Net Price])
    VAR __Result = IF(HASONEVALUE(Sheet1[Date]), [Net price]SUMX(__Table[__Value]))
RETURN
    __Result"

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

Hi @Greg_Deckler 

Thanks for your update.

But I still have the save problem with incorrect totals.

The8_0-1713264318256.png


Measure I used 

Net Price Total Date Material =
    "VAR __Table = SUMMARIZE( ALLSELECTED('Sheet1'), [Date],[Material],"__Value", [Net Price])
    VAR __Result = IF(HASONEVALUE(Sheet1[Date]), [Net price], SUMX(__Table, [__Value]))
RETURN
    __Result"

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.