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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Measure for Subtotals, using lower level measures, as values ​​for calculations

Hi All !

 

I need a measure for subtotals, using lower level measures, as values ​​for calculations. (This is a big problem that I can not solve for a long time.) See this file pls. 

 

I have a table with sales visits for different dates. 

 

 

DateSuperviserCityTradeAgent
01.01.19AABCA1
02.01.19AABCA2
01.01.19AABCA1
02.01.19BABCB1
01.01.19BABCB2
02.01.19BABCB1
01.01.19BABCB1
03.01.19AABCA1
02.01.19AABCA2
03.01.19AABCA1
01.01.19BABCB2
02.01.19BABCB1
04.01.19AABCA1
05.01.19AABCA2
04.01.19AABCA1
05.01.19BABCB1
01.01.19BABCB2
02.01.19BABCB1
01.01.19BABCB1
02.01.19AABCA1
02.01.19AABCA2
03.01.19AABCA1
01.01.19BABCB2
02.01.19BABCB1

I need to calculate a call rate plan hierarchy:

 

call rate plan  = isfiltered( [tradeAgent] ,
distinctcount(date visit) * distinctcount(tradeAgent) * 25 ,
isfiltered ( [superViser] , 
sum (values lower lvl measure) and etc

Now measure give correct result only for TradeAgent :

call rate plan  = distinctcount(date visit) * distinctcount(tradeAgent) * 25 
sub total.JPG

I thought sumx would give the desired result for SuperViser and City, but Sumx gives wrong result (very high results, Why Sumx  dont give disitinct (date) and (tradeAgent) i dont know) :

Call rate plan for SuperViser = sumx (disitinctcount(date)*disitinctcount(tradeAgent)*25)

If you have ideas on how to calculate values for the entire hierarchy up to GrandTotal, please share.

 

When solving this problem, it will be possible to look average sales per visit (for example, for a period of 3 days, there is point A with 3 visits and an order for $ 300 where the average value is 300/3 = 100 $, and point B with 2 visits and order for $ 300 where the average value is 300/2 = 150$, which are included in the ABC zone for it, the measure will count 600 $ /3 (distinct(date))= $ 200, but it will be correct to take the average of the average (100 + 150) / 2 = 125 $ .  Very bad that can not work with values ​​in the hierarchy

 

 

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

So basically it sounds like you want the sum of the distinct dates for each agent * 25. The following expression will do that and gives the output you want.

 

= SUMX(VALUES(Table1[TradeAgent]), CALCULATE(DISTINCTCOUNT(Table1[Date])) * 25)

View solution in original post

1 REPLY 1
d_gosbell
Super User
Super User

So basically it sounds like you want the sum of the distinct dates for each agent * 25. The following expression will do that and gives the output you want.

 

= SUMX(VALUES(Table1[TradeAgent]), CALCULATE(DISTINCTCOUNT(Table1[Date])) * 25)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors