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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Baerbel
Helper I
Helper I

Total for a measure don't sum up correctly in a row

Dear experts,

 

I have already received many good tips and advice here. So I hope you can help me totday again. I'm racking my brains to find out why the total sum per row for a measure doesn't show the correct value, as you can see in the tabel below for "Total (Current + Forecast)", while the separate measures are summed up correctly

MeasureABCDETotal
Total (Current + Forecast)2347315427112
   Current2347   70
   Forecast  315427112

 

All three are measures, created as follows

Current = SUM('tblA'[Statusquo])

Forecast =  if ((SUM('tblB'[Future])  -  SUM('tblA'[Statusquo])) < 0,   SUM('tblB'[Future]),  SUM('tblB'[Future]) -  SUM('tblA'[Statusquo])

Total (Current + Forecast) = Current + Forecast

 

I really would much appreciate to get any support to find my mistake 🤔. Thanks a lot in advance

Baerbel

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Baerbel ,

Please refer to the pbix file to see if it helps you.

Create measures.

Future_adj_1 =
VAR _a = [Future_adj]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", [Future_adj] )
RETURN
    IF ( HASONEVALUE ( tblC[subject] ), _a, SUMX ( _b, [aaa] ) )
Future_adj_sumx_1 =
VAR _a = [Future_adj_sumx]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", [Future_adj_sumx] )
RETURN
    IF ( HASONEVALUE ( tblC[subject] ), _a, SUMX ( _b, [aaa] ) )
Statausquo + Future_adj_1 =
VAR _a = [Statausquo + Future_adj]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", [Statausquo + Future_adj] )
RETURN
    IF ( HASONEVALUE ( tblC[subject] ), _a, SUMX ( _b, [aaa] ) )

vpollymsft_0-1649814606807.png

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


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

Thanks @Ashish_Mathur for taking time - in the meantime @Anonymous was able to help me - the link to the file is part of polly's post.

 

All the best

Bärbel

Anonymous
Not applicable

Hi @Baerbel ,

I have created a simple sample, please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _a = tblB[TOTAL]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", tblB[TOTAL] )
RETURN
    IF ( HASONEVALUE ( tblB[subject] ), _a, SUMX ( _b, [aaa] ) )

vpollymsft_0-1649743369393.png

If I have misunderstood your meaning, please provide your pbi file without privacy information and your desired output.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @Anonymous 

 

thanks for taking time to help me and the PBIX File. If I understood correctly you re proposing to create a new table bringing together the different data - this I have to try, as my basic tables are a bit more complex. I tried to put it in your pbix-File a a new page - where I put in my current beginnings of creating measures with probably a lot of beginner-mistakes. If you have a little bit more time to invest in my learnings I would appreciate it. Thanks in advance.

Total for a measure don't sum up correctly in a row.pbix

 

Bärbel

Anonymous
Not applicable

Hi @Baerbel ,

Please refer to the pbix file to see if it helps you.

Create measures.

Future_adj_1 =
VAR _a = [Future_adj]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", [Future_adj] )
RETURN
    IF ( HASONEVALUE ( tblC[subject] ), _a, SUMX ( _b, [aaa] ) )
Future_adj_sumx_1 =
VAR _a = [Future_adj_sumx]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", [Future_adj_sumx] )
RETURN
    IF ( HASONEVALUE ( tblC[subject] ), _a, SUMX ( _b, [aaa] ) )
Statausquo + Future_adj_1 =
VAR _a = [Statausquo + Future_adj]
VAR _b =
    SUMMARIZE ( tblB, tblB[subject], "aaa", [Statausquo + Future_adj] )
RETURN
    IF ( HASONEVALUE ( tblC[subject] ), _a, SUMX ( _b, [aaa] ) )

vpollymsft_0-1649814606807.png

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous 

 

it works 😀 happy - Thanks so much for your help 😍- I now have a solution and learnt a lot about creating the right measures.

All the best

Bärbel

amitchandak
Super User
Super User

@Baerbel use the correct column in summarize or values

 

sumx(values(Table[Column]), calculate( if ((SUM('tblB'[Future]) - SUM('tblA'[Statusquo])) < 0, SUM('tblB'[Future]), SUM('tblB'[Future]) - SUM('tblA'[Statusquo]) )))

 

 

or

 

sumx(summarize(Table, Table[Column],"_1", calculate( if ((SUM('tblB'[Future]) - SUM('tblA'[Statusquo])) < 0, SUM('tblB'[Future]), SUM('tblB'[Future]) - SUM('tblA'[Statusquo]) ))), [_1])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@amitchandak  thanks for your quick reply and sorry for asking again, as I'm a beginner -  sumx(values(Table[Column])  -- what does it refer to, as I'm "in a matrix visual", where I combined "Current" and "Futture" from two different tables - Does ist mean, that I've to create a new table to get the right total? For all other it works fine

Thanks for helping me

Baerbel

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.