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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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