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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
blader1989
Helper II
Helper II

Display the accumulate count of unique customers in matrix table when filtering is all

Dear all,

 

I am currently working on a formula that can accumulate count of unique customers with a total value greater than 0 for each month in the fiscal year. Currently, I have written the formula below for accumulate count of unique customers with a total value greater than 0 (Column 'Total (-VAT)' in raw table).

 

FY ECO = CALCULATE (

     DISTINCTCOUNT(raw[Customer Code]),

    FILTER (

        ALLSELECTED(raw),

        MAX(raw[Billing Date]) >= raw[Billing Date] && SUM(raw[Total (-VAT)]) > 0

    ))

However, when I drag this formula into the matrix table for visualize, I have to select each corresponding channel in Sub-Channel filter to get the correct desired total for each channel. Image for reference:

each when click sub channel.JPG

However, my matrix table already includes all the channels, and it still displays all unique customers with a total value greater than 0 for each channel as in the formula above when the Sub-Channel is All. Image for reference:

sub-channel all.JPG

So, how can I adjust the formula to display the accumulate count of unique customers with a total value greater than 0 for each channel, as shown in the table below which I try to get when the Sub-Channel filter is All?

FY ECO

2021

 

 

 

 

 

 

 

 

 

 

 

Year
Sub-Channel

Jan

Feb

Mar

Apr

May

Jun

Jul

Aug

Sep

Oct

Nov

Dec

General Clinic

146

163

191

211

223

228

233

236

240

251

257

268

GOV.Hospital

37

51

69

88

91

106

116

123

127

129

135

140

Healthcare Center

7

10

12

20

28

31

36

39

41

42

43

44

Hospital Pharmacy

197

267

311

337

348

363

413

430

442

449

459

470

Private Hospital

120

129

143

152

154

155

161

163

167

161

175

179

 

Thank you so much in advance for your time when reading my post. Your help would be very apprieciated a lot for me!!! 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@blader1989 , Create two measures like , always prefer date table

 

M1= SUM(raw[Total (-VAT)])

Cumm Sales = CALCULATE(Countx(Values(raw[Customer Code]), if([M1]>0, raw[Customer Code], blank())),filter(allselected(date),date[date] <=max(date[Date])))

 

Running Total/ Cumulative:
https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=42

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
blader1989
Helper II
Helper II

Hello @amitchandak , that's really helped me a lot. Thank you so much.

 

For the monthly sales order which will be calculated by counting unique customer that total value large than 0, can I use your same formula like this? 

 

M1= SUM(raw[Total (-VAT)])

Monthly sales order = CALCULATE(Countx(Values(raw[Customer Code]), if([M1]>0, raw[Customer Code], blank()))

amitchandak
Super User
Super User

@blader1989 , Create two measures like , always prefer date table

 

M1= SUM(raw[Total (-VAT)])

Cumm Sales = CALCULATE(Countx(Values(raw[Customer Code]), if([M1]>0, raw[Customer Code], blank())),filter(allselected(date),date[date] <=max(date[Date])))

 

Running Total/ Cumulative:
https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=42

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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