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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
janani80
Frequent Visitor

Matrix Visual

Hi All,

 

I am working on matrix visual and I have multiple year data and based on the year slicer I want my data to reflect. Also the header in the matrix should change dynamically. Eg if I select the year as 2024 then the sales, commission & Volumes should show Previous (year- 2023) and the rest should show year as 2024.

Any help on this is really appreciated.

 

  Filter     
  2022     
  2023     
  2024     
        
        
 20232024
Leader NameSalesCommissionVolumesSalesCallsRejectionsLeads
A       
B       
C       
D       
E       
        
2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @janani80 

 

This is possible but the approach is not very straightforward. You'll need a disconnected table to hold the name of the measures and sales is sorted twice, being the first one and then after volumes, another column has to be created that has a different value that still appears as sales thus the calculated column in the screenshot below.

danextian_1-1733834783891.png

Then you will need two more disconnected tables both containing the years - the first one will be used as a dimension while the other one in a slicer.

 

And then the measures that will bind these unrelated tables in a visual.

Switch Measure = 
VAR SelectedSort =
    SELECTEDVALUE ( 'Calculations'[Sort] )
RETURN
    SWITCH (
        SelectedSort,
        1, [Sales Amt],
        2, [Commission Amt],
        3, [Volumes Amt],
        4, [Sales Amt],
        5, [Calls Amt],
        6, [Rejections Amt],
        7, [Leads Amt]
    )

 

Dynamic Measure = 
VAR SelectedSort =
    SELECTEDVALUE ( 'Calculations'[Sort] )
VAR SelectedYear =
    SELECTEDVALUE ( Years2[Year] )
RETURN
    IF (
        SelectedSort <= 2,
        CALCULATE (
            [Switch Measure],
            FILTER (
                VALUES ( DateTable[Year] ),
                DateTable[Year]
                    IN VALUES ( Years[Year] )
                        && DateTable[Year] < SelectedYear
            )
        ),
        IF (
            SELECTEDVALUE ( Years[Year] ) = SelectedYear,
            CALCULATE ( [Switch Measure], KEEPFILTERS ( DateTable[Year] = SelectedYear ) )
        )
    )

And here's the output

danextian_3-1733835360300.gif

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

v-zhouwen-msft
Community Support
Community Support

Hi @janani80 ,

If your question is not resolved, you are welcome to continue asking questions. If it is solved please mark the corresponding answer as a solution.

 

Best Regards

View solution in original post

4 REPLIES 4
v-zhouwen-msft
Community Support
Community Support

Hi @janani80 ,

If your question is not resolved, you are welcome to continue asking questions. If it is solved please mark the corresponding answer as a solution.

 

Best Regards

danextian
Super User
Super User

Hi @janani80 

 

This is possible but the approach is not very straightforward. You'll need a disconnected table to hold the name of the measures and sales is sorted twice, being the first one and then after volumes, another column has to be created that has a different value that still appears as sales thus the calculated column in the screenshot below.

danextian_1-1733834783891.png

Then you will need two more disconnected tables both containing the years - the first one will be used as a dimension while the other one in a slicer.

 

And then the measures that will bind these unrelated tables in a visual.

Switch Measure = 
VAR SelectedSort =
    SELECTEDVALUE ( 'Calculations'[Sort] )
RETURN
    SWITCH (
        SelectedSort,
        1, [Sales Amt],
        2, [Commission Amt],
        3, [Volumes Amt],
        4, [Sales Amt],
        5, [Calls Amt],
        6, [Rejections Amt],
        7, [Leads Amt]
    )

 

Dynamic Measure = 
VAR SelectedSort =
    SELECTEDVALUE ( 'Calculations'[Sort] )
VAR SelectedYear =
    SELECTEDVALUE ( Years2[Year] )
RETURN
    IF (
        SelectedSort <= 2,
        CALCULATE (
            [Switch Measure],
            FILTER (
                VALUES ( DateTable[Year] ),
                DateTable[Year]
                    IN VALUES ( Years[Year] )
                        && DateTable[Year] < SelectedYear
            )
        ),
        IF (
            SELECTEDVALUE ( Years[Year] ) = SelectedYear,
            CALCULATE ( [Switch Measure], KEEPFILTERS ( DateTable[Year] = SelectedYear ) )
        )
    )

And here's the output

danextian_3-1733835360300.gif

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks you. Your solution worked.

Ritaf1983
Super User
Super User

Hi @janani80 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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