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

Compare values in matrix visual with different filters

Hello Everyone,

I have a dataset with 3 columns Account, Amount and Year Scenario. I want to create a matrix visual in which I can compare different scenarios with each other. 

I have attached a screenshot of data. 
Year scenario-2 is a duplicate column of year scenario. If I select something in filter Year scenario then Amount1(which is a measure based on year scenario) should change and If I select something from Year scenario-2 then Amount2(which is a measure based on year scenario-2) should change. So that I can compare amount with different scenarios(For example- 2015 ACT vs 2018 BGT, 2016 FQ1 vs 2017 ACT etc). 

Sample data :

Account AmountYear Scenario
XXXXXXX5000002015 BGT
AAAAAA4000002015 BGT
AABBBBB1000002015 ACT
ZZZZZZZZ7305012016 ACT
AABBBBB6463242016 FQ1
AABBBBB8233832016 BGT
XXXXXXX3087112016 BGT
ZZZZZZZZ9634622016 FQ3
AABBBBB5931402016 FQ3
XXXXXXX4095432017 BGT
ZZZZZZZZ3405172017 BGT
XXXXXXX3937782017 ACT
AAAAAA8891712017 FQ1
ZZZZZZZZ9256652017 FQ1
AAAAAA1365492017 FQ3
AABBBBB6507492017 FQ3
XXXXXXX5230942018 BGT
ZZZZZZZZ5548252018 BGT
   

Any suggestion is appreciated.

Thanks,

sample.PNG

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

Based on my test with your shared pbix file, you may need to take two more steps to make it work.

 

1. Remove all relationships among the three tables.

 

rs1.PNG

 

2. Use "Year Scenario" column from Date1, and "Year Scenario-2" column from Date2 as Slicers, instead of using them from Test_data table.

 

r1.PNG

 

Here is the modified pbix file for your reference. Smiley Happy

 

Regards

View solution in original post

8 REPLIES 8
v-ljerr-msft
Employee
Employee

Hi @Anonymous,

 

If I understand you correctly, you should be able to firstly add to two individual calendar tables in your model which contains the column 'Year scenario' and 'Year scenario-2' separate.

 

Then use the formulas below to create two measures to calculate Amount for the selected 'Year scenario' and 'Year scenario-2' in your scenario. Smiley Happy

Amount1 =
CALCULATE (
    SUM ( 'Table1'[Amount] ),
    FILTER (
        'Table1',
        CONTAINS ( Date1, Date1[Year Scenario], 'Table1'[Year Scenario] )
    )
)
Amount2 =
CALCULATE (
    SUM ( 'Table1'[Amount] ),
    FILTER (
        'Table1',
        CONTAINS ( Date2, Date2[Year Scenario-2], 'Table1'[Year Scenario] )
    )
)

Note: You'll need replace the bold with your real table names.

 

Regards

Anonymous
Not applicable

Hello @v-ljerr-msft

 

Thank you for the reply. 

I am still facing the same issue. Let's say I select Year Scenario 2015 ACT from filter Year Scenario then I am getting the same amount in Amount1 and Amount2. And when I select Year Scenario 2015 ACT from filter Year Scenario and 2017 BGT from Year scenario-2, I am getting blank values in both Amount1 and Amount2. 
What I want is to compare Amount for different Year scenarios (For example - 2015 ACT vs 2017 BGT).

Hi @Anonymous,

 

Based on my test with your shared pbix file, you may need to take two more steps to make it work.

 

1. Remove all relationships among the three tables.

 

rs1.PNG

 

2. Use "Year Scenario" column from Date1, and "Year Scenario-2" column from Date2 as Slicers, instead of using them from Test_data table.

 

r1.PNG

 

Here is the modified pbix file for your reference. Smiley Happy

 

Regards

Anonymous
Not applicable

Hi @v-ljerr-msft

 

Thank you for the help. 
After removing the relationship, it worked for me.

 

Thanks

Anonymous
Not applicable

Hello @v-ljerr-msft

 

Is there a way to calculate this within the same table (test_data). I need to use year scenario for other visual also and there should be an interaction between all the visualization.

I created a new table Measure Dimensions with year scenario(Measure). I created measures for different scenarios and using them in the switch function. 

Measure Selection =
SWITCH( TRUE(),
VALUES('Measure Dimensions'[Measure]) = "2015 ACT", [2015 ACT],
VALUES('Measure Dimensions'[Measure]) = "2015 BGT", [2015 BGT],
VALUES('Measure Dimensions'[Measure]) = "2015 FQ1", [2015 FQ1],
VALUES('Measure Dimensions'[Measure]) = "2015 FQ3", [2015 FQ3],
VALUES('Measure Dimensions'[Measure]) = "2016 ACT", [2016 ACT],
VALUES('Measure Dimensions'[Measure]) = "2016 BGT", [2016 BGT],
VALUES('Measure Dimensions'[Measure]) = "2016 FQ1", [2016 FQ1],
VALUES('Measure Dimensions'[Measure]) = "2016 FQ3", [2016 FQ3],
VALUES('Measure Dimensions'[Measure]) = "2017 ACT", [2017 ACT],
VALUES('Measure Dimensions'[Measure]) = "2017 BGT", [2017 BGT],
VALUES('Measure Dimensions'[Measure]) = "2017 FQ1", [2017 FQ1],
VALUES('Measure Dimensions'[Measure]) = "2017 FQ2", [2017 FQ2],
VALUES('Measure Dimensions'[Measure]) = "2017 FQ3", [2017 FQ3],
VALUES('Measure Dimensions'[Measure]) = "2018 BGT", [2018 BGT])

 

Measure Selection2 =
SWITCH( TRUE(),
VALUES('Measure Dimensions'[Measure]) = "2015 ACT", [2015 BGT],
VALUES('Measure Dimensions'[Measure]) = "2015 BGT", [2016 BGT],
VALUES('Measure Dimensions'[Measure]) = "2015 FQ1", [2016 FQ1],
VALUES('Measure Dimensions'[Measure]) = "2015 FQ3", [2016 FQ3],
VALUES('Measure Dimensions'[Measure]) = "2016 ACT", [2016 ACT],
VALUES('Measure Dimensions'[Measure]) = "2016 BGT", [2015 FQ3],
VALUES('Measure Dimensions'[Measure]) = "2016 FQ1", [2017 FQ1],
VALUES('Measure Dimensions'[Measure]) = "2016 FQ3", [2015 FQ3],
VALUES('Measure Dimensions'[Measure]) = "2017 ACT", [2016 ACT],
VALUES('Measure Dimensions'[Measure]) = "2017 BGT", [2016 ACT],
VALUES('Measure Dimensions'[Measure]) = "2017 FQ1", [2018 BGT],
VALUES('Measure Dimensions'[Measure]) = "2017 FQ2", [2017 BGT],
VALUES('Measure Dimensions'[Measure]) = "2017 FQ3", [2017 BGT],
VALUES('Measure Dimensions'[Measure]) = "2018 BGT", [2017 FQ3])

 

This is working if there is no relation between Test_data & Measure Dimensions.
I want to use year scenario as a filter and all the visualization should change based on filter selection.

 

Any suggestions are appreciated.

Thanks

Anonymous
Not applicable

Hi, did you ever find a solution?

Hi @Anonymous,

 

Could you share a dummy pbix file which can reproduce the issue, so that we can further assist on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploadingSmiley Happy

 

Regards

Anonymous
Not applicable

Hi @v-ljerr-msft

 

Here is the link to dummy pbix and data file. 

https://lpl-my.sharepoint.com/:f:/g/personal/prakumar_clasp-infra_com/EmmpgeCXT7tDkOC5T7OQFJQByP25yU...

Looking forward to your response.

Thanks.

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.