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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

COLUMN TOTAL DOES NOT ADD UP

Hello community,
I have this case I hope someone can help me.

First we have the sales by customer :

B1 - Sellout (S) = SUM('TB - SALE'[VENTASINIGV])

Epuma_5-1664894003877.png


Then I have to validate if this client did not buy me 6 months before then I consider it as a new client:

I1 - Sellout -6M < =
-- 01/03/2022 Min , 31/08/2022 Max , 30/09/2022 Actual
if(isblank([B1 - Sellout (S)])||[B1 - Sellout (S)]<=0,blank(),
if(isblank(CALCULATE([B1 - Sellout (S)],
DATESBETWEEN('TC - CALENDAR'[date],
DATE(YEAR(EOMONTH(Max('TB - SALE'[DATE]),-[Value - Periods])),MONTH(EOMONTH(Max('TB - SALE'[DATE]),-[Value - Periods])),1),
EOMONTH(Max('TB - SALE'[DATE]),-1)
))
)
||
CALCULATE([B1 - Sellout (S)],
DATESBETWEEN('TC - CALENDAR'[date],
DATE(YEAR(EOMONTH(Max('TB - SALE'[DATE]),-[Value - Periods])),MONTH(EOMONTH(Max('TB - SALE'[DATE]),-[Value - Periods])),1),
EOMONTH(Max('TB - SALE'[DATE]),-1)
))<=0
,1,
blank()
)
)

Epuma_6-1664894158440.png

So far everything ok is validating correctly, now I need the totals to add up.

I2 - New Clients -6M< =
CALCULATE(countx(distinct('TB - SALE'[CustomerConnection]),if([I1 - Sellout -6M <]=1,1,blank())))

Epuma_7-1664894191090.png

This measure, although it is adding correctly by column, the total of rows ignores it.
Try the following:

I3 - New Clients -6M< =
IF(COUNTROWS(VALUES('TC - CALENDAR'[Period])) =1,[I2 - New Customers -6M<],SUMX(VALUES('TB - SALE'[CustomerConnection]),1))

Epuma_8-1664894252323.png

Which places me the 1 per row but in the end is adding 9 when in reality it should be 8.


Row labels2022-22022-32022-42022-52022-62022-72022-82022-9Total general
AREQUIPA.01.80123000000000126 1055 1055
AREQUIPA.01.80123000000000181 216 375 859 1450
AREQUIPA.01.80123000000000345 1354 1354
AREQUIPA.01.80123000000000411 10157 10157
AREQUIPA.01.80123000000001063 103103
AREQUIPA.01.80123000000001718 648 648
AREQUIPA.01.80123000000010066 187 484 671
AREQUIPA.01.80123000000010406 3520 352
AREQUIPA.01.80123000000010519 2525
Total general 568105556210157269764812815815







1 REPLY 1
v-xiaotang
Community Support
Community Support

Hi @Syndicate_Admin 

Thanks for reaching out to us.

>>

vxiaotang_0-1664962387015.png

The total row is to count the rows on it. There are 9 rows of 1 on it, so total=9. If you need it to output other values, you can use some functions, such as hasonevalue(), hasonefilter() and so on.

Something like this

IF(HASONEFILTER(table[col]), [measure], [total measure])

 

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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