Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I use two slicers in Power BI to select the two columns to be used on a column chart?

I am trying to use two slicers in Power BI to select the StartYear and EndYear columns for a column chart.
The only two bars on the chart will be the sum of revenue for the selected two years.

I’ve tried using two separate tables connected to a common one, with one-to-many relationships and cross filtering in one direction, but that won’t work.
(https://i.sstatic.net/8jtVJITK.png)

This is what I want the chart to look like, with two single-select slicers instead of one multi-select.(https://i.sstatic.net/KhJP5nGy.png)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

First, remove your relationships (but keep your "flanking" tables), they just make this harder for you, since if you select different years you effectively exclude all your fact table rows from the evaluation.

Then you can use a measure that looks something like this:

Revenue = 
VAR _min = SELECTEDVALUE ( StartYear[Year] )
VAR _max = SELECTEDVALUE ( EndYear[Year] )
RETURN
IF ( 
    SELECTEDVALUE ( IncCAGRTable[Year] ) IN { _min,_max } ,
    SUM ( IncCAGRTable[SumRevenue] )
)

I haven’t tested this since I don’t have access to a Windows box at the moment.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading