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

View all the Fabric Data Days sessions on demand. View schedule

Reply
hershey
New Member

New Count column in matrix

Hi,

 

I've the following results in matrix table

hershey_1-1663644547173.png

 

I'd like to add a new Count column to indicate total count of customers with spending above or equal 100, results should be as below.

hershey_2-1663644593366.png

 

But i'm unable to get the results. Much help is appreciated. Thanks

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@hershey 
Please refer to attached sample file

1.png

Spending = 
VAR CurrentSpending = [AvgSales]
VAR T1 =
    ADDCOLUMNS ( VALUES ( 'fct_tst'[businessday_YYYY-MM-DD].[Month] ), "@Spending", [AvgSales] )
VAR T2 =
    FILTER ( T1, [@Spending] >= 80 )
VAR CountAbove80 =
    FORMAT ( COUNTROWS ( T2 ), "#" )
RETURN
    IF ( HASONEVALUE ( 'fct_tst'[businessday_YYYY-MM-DD].[Month] ), CurrentSpending, CountAbove80 )

View solution in original post

5 REPLIES 5
hershey_ash
Regular Visitor

Hi tamerj1, works perfectly........

 

one last Q, Activate the column total and rename it "Count" ---> where do i rename this? Currently it's shown as 'Total'

@hershey_ash 
Select the visual and follow steps in the screenshot. Please note that I've posted two solutions. The 2nd one sums the counts therefore can be used in a card visual in case needed.

1.png

tamerj1
Super User
Super User

@hershey 
Please refer to attached sample file

1.png

Spending = 
VAR CurrentSpending = [AvgSales]
VAR T1 =
    ADDCOLUMNS ( VALUES ( 'fct_tst'[businessday_YYYY-MM-DD].[Month] ), "@Spending", [AvgSales] )
VAR T2 =
    FILTER ( T1, [@Spending] >= 80 )
VAR CountAbove80 =
    FORMAT ( COUNTROWS ( T2 ), "#" )
RETURN
    IF ( HASONEVALUE ( 'fct_tst'[businessday_YYYY-MM-DD].[Month] ), CurrentSpending, CountAbove80 )
tamerj1
Super User
Super User

Hi @hershey 

you can utilize the total column to disply this value. Activate the column total and rename it "Count". Then replace the measure in the matrix with this measure

1.png

Spending = 
VAR CurrentSpending = [AvgSales]
VAR TotalCount =
	SUMX ( 
		VALUES ( FCT_tst[cust] ),
		CALCULATE ( 
			VAR T1 =
				ADDCOLUMNS ( VALUES ( 'fct_tst'[businessday_YYYY-MM-DD].[Month] ), "@Spending", [AvgSales] )
			VAR T2 =
				FILTER ( T1, [@Spending] >= 80 )
			RETURN
				COUNTROWS ( T2 )
		)
	)
RETURN
	IF ( HASONEVALUE ( 'fct_tst'[businessday_YYYY-MM-DD].[Month] ), CurrentSpending, FORMAT ( TotalCount, "#" ) )

 

 

Hi tamerj1, 

 

Thanks a lot for the help.

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