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
Anonymous
Not applicable

Need help with Dax Formula; Displays right row results, but wrong total

Hey Everyone, 

I have made several meausre that I add in an ending measure. It gives me the right results, but only in the form of rows. But the v total of the predefined rows is completely wrong.

Final measure = [value A] / ([Value B] + [Value C] + [Value D] + 1.7 * [Value E])

So here you see that the value A is to be divided on the last values, which are in parentheses. Have tried to split the measure up, so I have what is going to be diveded by in is own measure, but that didnt work either. 
But I wonder if anyone can help me with why the total gets wrong.



( Just an example )
Final measure:

ID: Final measure

1            10
2            11
3            12
4            13
5            14

----------------------------
total       22

 

------------------------------------------------------------------------------------
Value A = Is just two columns that are added together.

Value B = SUMX (TABLE; TABLE [VALUE B / 1000)

VALUE C: = [Cloumn] - [Value E]


Value D = SUMX (TABLE, TABLE [VALUE D] / 1000)

1.7 is a value that must be added. For the values ​​to be correct.

Value E = SUM (Coulumn) / 1000.


Final measure = [value A] / ([Value B] + [Value C] + [Value D] + 1.7 * [Value E])


Value E, is in another Table then the rest of the values. But matches with each other when it comes to ID. Thats the relationship. 

As said, all values ​​will be correct if you filter on ID. Or see it for each row, but the total will be completely wrong.

Possibly I can set up my formula in a different way, I'm not entirely sure. Possibly you can solve this in other ways too?
All help had been very very helpful,

Thank you, to everyone in advance.

Wondering something else or something that's unclear. Please feel free to ask.

best regards

10 REPLIES 10
v-yuezhe-msft
Employee
Employee

@Anonymous,

Create a new measure using DAX below, then drag the new measure to your visual and check if the total value is correct.

NewMeasure = IF(COUNTROWS(VALUES(Table[ID]))=1, [Final measure],SUMX(VALUES(Table[ID]),[Final measure]))



Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yuezhe-msftv-yuezhe-msft
Thanx for ur effort and replay, but are you sure that the formula is correct written? I do get some errors, when i am trying to reuse your formula. Please check again, and confirm

@Anonymous,

Please post a screenshot about your DAX and post the error message.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yuezhe-msft
Screenshot is attached. Please write the formula, and let me copy and paste it. Cheers, thanx alot

@Anonymous,

Please use one of the following DAX.

NewMeasure = IF(COUNTROWS(VALUES(Sales[ID]))=1, [final calculation],SUMX(VALUES(Sales[ID]),[final calculation]))
NewMeasure = IF(COUNTROWS(VALUES(Sales[ID]))=1; [final calculation];SUMX(VALUES(Sales[ID]);[final calculation]))



Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yuezhe-msft
The formula is working now, but the measure is blank. Dosent display anything when dragged in for visualize

Anonymous
Not applicable

Hey Everyone, 

I have made several meausre that I add in an ending measure. It gives me the right results, but only in the form of rows. But the total of the predefined rows is completely wrong.

Final measure = [value A] / ([Value B] + [Value C] + [Value D] + 1.7 * [Value E])

So here you see that the value A is to be divided on the last values, which are in parentheses. Have tried to split the measure up, so I have what is going to be diveded by in is own measure, but that didnt work either. 
But I wonder if anyone can help me with why the total gets wrong.



( Just an example )
Final measure:

ID: Final measure

1            10
2            11
3            12
4            13
5            14

----------------------------
total       22

 

------------------------------------------------------------------------------------
Value A = Is just two columns that are added together.

Value B = SUMX (TABLE; TABLE [VALUE B / 1000)

VALUE C: = [Cloumn] - [Value E]


Value D = SUMX (TABLE, TABLE [VALUE D] / 1000)

1.7 is a value that must be added. For the values ​​to be correct.

Value E = SUM (Coulumn) / 1000.


Final measure = [value A] / ([Value B] + [Value C] + [Value D] + 1.7 * [Value E])


Value E, is in another Table then the rest of the values. But matches with each other when it comes to ID. Thats the relationship. 

As said, all values ​​will be correct if you filter on ID. Or see it for each row, but the total will be completely wrong.

Possibly I can set up my formula in a different way, I'm not entirely sure. Possibly you can solve this in other ways too?
All help had been very very helpful,

Thank you, to everyone in advance.

Wondering something else or something that's unclear. Please feel free to ask.

best regards

Hi @Anonymous,

 

Based on your description, I have made a test and I do could reproduce your issue, this issue may caused by the different context for your measures.

 

I have found a similar thread which has been solved you could refer to.

 

I also made a test with the solution that thread mentioned, it worked. If you want to see the details, you could have a look at the attachment.

 

I created another measure Measure 2 = SUMX(VALUES(PayType[PayType]),[Measure])

 

measure.png

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous,

Do you create a table visual using ID field and the measure? If you still have questions about the result, please share sample data of your original table so that we can test.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

formuka.PNG

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.