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
revmac
New Member

How to Make Measures Total Correctly in Power BI Tables

It seems that fixing incorrect totals in Power Bi is a common problem.

 

Nevertheless, none of the solutions I found did the trick.

 

I have some columns in my table that use measures and I want to sum only the rows that contains information.

 

As we can see in the example below, the total is incorrect.

 

revmac_0-1672752343650.png

 

The measure is defined by the following formula:

 

 

CALCULATE(
	[dmdDiasDisponiveisLast30d] * SUM(fPlanogram_analysis[booleanRompido]) * AVERAGE(fVendas_geral[PrecoVendaUnit_100])
)

 

 

Note that [dmdDiasDisponiveisLast30d] is also a measure.

 

I tried using SUMX in many ways but it did not work.

 

Maybe it's because I'm using another measure inside the calculate...

 

Do I have to use summarize?

 

Thanks is advance

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @revmac 

 

You can try the following methods.

Measure 2 = CALCULATE([Measure1]*SUM('Table'[Value2])*AVERAGE('Table'[Value3]))
Measure 3 = IF(HASONEVALUE('Table'[Value2]),[Measure 2],SUMX('Table',[Measure 2]))

vzhangti_0-1672822195114.png

IF(HASONEVALUE()) can control the output of Total.
 

Best Regards,

Community Support Team _Charlotte

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

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @revmac 

 

You can try the following methods.

Measure 2 = CALCULATE([Measure1]*SUM('Table'[Value2])*AVERAGE('Table'[Value3]))
Measure 3 = IF(HASONEVALUE('Table'[Value2]),[Measure 2],SUMX('Table',[Measure 2]))

vzhangti_0-1672822195114.png

IF(HASONEVALUE()) can control the output of Total.
 

Best Regards,

Community Support Team _Charlotte

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

Hi, thanks for the help

 

I tried your suggestion but unfortunately it dit not work yet.

 

MEASURE 2

valorVendaPerdidaDMD30d =
CALCULATE(
[dmdDiasDisponiveisLast30d] * SUM(fPlanogram_analysis[booleanRompido]) * [mediaPrecoUn_30d]
)

 

 

MEASURE 3
valorVendaPerdidaDMD30d_sumx = IF(HASONEVALUE(fPlanogram_analysis[booleanRompido]),[valorVendaPerdidaDMD30d],SUMX(fPlanogram_analysis,[valorVendaPerdidaDMD30d]))

When I inserted this last measure in the table columns I got the error "Can't display the visual"...


Is it related to the measures inside the measure2? 

Or the relations between columns in the table?

 

Thanks in advance.

DimaMD
Solution Sage
Solution Sage

@revmac hi, Provide dummy data for testing.


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Hi @DimaMD , could you please advise me on how to do that ? I have lots of tables in my pbix... 

@revmac  hi, try it 

sumx(
values(table[colun_id]),
[measure])

or
if (
hasonevalue(table[colum]),
[measure],
sumx(value(table[colum])),
[measure])
)

__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

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.