Forum Discussion
Matrix Table Shows More Than Top 5 Customers per Store When Adding Year/Month – How to Fix
Hi - Currently my table (named Overview) is displaying Sites (via distinct site table) and Customers (via distinct customer table) as the Matrix Table's rows and the overall store sales + top 5 customer sales (depending on the time period picked).
I'm experiencing a problem where:
1. I can't seem to make a Top/Bottom 20 stores slicer (based off sales)
2. Adding Date columns to my Matrix Table rows removes my top 5 Customers row condition and instead shows 6 or more customer rows/exceeds query resources
To illustrate what i'm doing currently - I made the table's sales value by these measures:
Total Sales = SUM( Overview[Sales])
Then i used this measure as the Matrix Table value:
MEASURE-SALES = IF( ISINSCOPE( 'Unique Customers'[Customer] ), [Total Sales], CALCULATE( [Total Sales], REMOVEFILTERS( 'Unique Customers'[Customer] ) ) )
As mentioned before - i also made the table show each store's top 5 customers via this rank:
Customer Rank = VAR BaseTable = ADDCOLUMNS(
CALCULATETABLE(
SUMMARIZE(
Overview,
'Unique Customers'[Customer],
'Unique Stores'[Store]
),
REMOVEFILTERS( 'Unique Customers' )
),
"@val", [Total Sales]
)
VAR Result = RANK(
SKIP,
BaseTable,
ORDERBY( [@val], DESC ),
PARTITIONBY( 'Unique Stores'[Store] )
)
RETURN Resultthen i set this measure as = 1 in the table's filter
Customer is visible = VAR CustomerRank = [Customer Rank]
VAR Result = IF( ( CustomerRank <= 5 && NOT ISBLANK( CustomerRank ) )
|| NOT ISINSCOPE( 'Unique Customers'[Customer] ), 1 )
RETURN Result
My date table is below for reference (capped at current month for YOY measure purposes not mentioned above):
Date =
ADDCOLUMNS (
CALENDAR (
DATE (2023, 1, 1),
DATE (2025, 4, 30)
),
"Year", YEAR([Date]),
"Year-Month", FORMAT([Date], "yyyy-MM"),
"Year-Month sort", EOMONTH([Date], 0)
)Would like some guidance- thanks
- Anonymous1 year agoHi derekli1700 ,
Replace it with following DAX :
Customer Is Visible =VAR RankValue = [Customer Rank]RETURNIF(RankValue <= 5 && NOT ISBLANK(RankValue), 1, 0)If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.
Best Regards,
Sreeteja.
Community Support Team