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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Total in matrix visual

Hi there!

 

I have created a matrix visual (attach below) in power BI on a historical dataset with country and division as columns and corresponding measures like sales, sales MTD, sales QTD, sales last year, Sales MTD last year and so on. The matrix visual is linked with a date slicer.

 

Capture.PNG

the issue I am facing is that the total under row total is not matching to the total of corresponding column values. The reason being that the data is for multiple countries (2 countries) and multiple division(4 divisions), but on that particular date, data is available only for 1 country(A) and 3 division whereas the total at the end of the matrix for historical measures (QTD, YTD, last year QTD, last year MTD and Last year YTD) is showing the sum of both countries and all-division where ever sales data is present historically. 

 

is there a way to achieve one of the following:

        1. Sum of only the values been shown in the matrix

        2. Combination of all countries & division irrespective of the date slicer

 

the measures I have calculated are similar to this one:

Sales Fiscal YTD = CALCULATE(sum('Data'[Sales (Daily)]),DATESYTD('Date'[Date]))
 
Regards
 
1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

you can create a measure to use as a filter:

filterMeasure =
COUNTROWS ( SUMMARIZE ( 'Table'; 'Table'[Country]; 'Table'[Division] ) )

 

Add this measure to the filter pane of your visual and set it to filter on greater or equal to 1

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too. 

View solution in original post

4 REPLIES 4
sturlaws
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

you can create a measure to use as a filter:

filterMeasure =
COUNTROWS ( SUMMARIZE ( 'Table'; 'Table'[Country]; 'Table'[Division] ) )

 

Add this measure to the filter pane of your visual and set it to filter on greater or equal to 1

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too. 

Anonymous
Not applicable

Hi @sturlaws ,

 

Thank you very much for this. It's working.

Could you please also explain the rationale behind this? It will help me in understanding DAX better 😀 

 

Thanks in advance.

 

Regards,
Saket 

I'll try 🙂

 

Summarize('Table';'Table'[Country];'Table'[Division]) returns a table with the distinct rows of Country and Division that exist in the current filter context. 

 

In your table visual the filter context is made up of what you put on the rows of the matrix(division and country) and the slicer with date/month.

 

When you choose a month where some divisions and countries don't have a value, the measure returns 0(or blank). When you add that measure to the filter pane, the countries/divisions which have no values in the current context, these are filtered out from the year to date-calculation

 

Anonymous
Not applicable

Thank you once again @sturlaws

This was super helpful👍

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors