Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello all,
the following scenario is needed:
In my report i used the Measure A to be able to shown a measure when a user click on the slicer. But in this Measure A there is 2different measures that are filtered from two different columns.
The [Growth last month] is using the column Occupation[Month]
The [sacked last month] is using column Occupation[NextMonth]
Because of this two different columns for filtering some of my Power BI charts are not filtered.
So i though i add use a IF Then else statement in Measure A to say:
If the [Growth last month] are clicked in the slicer then a bar chart need to shown data based on the Occupation[Month]
and if the [sacked last month] then a bar chart need to shown data from Occupation[NextMonth]
Measure A =
SWITCH( TRUE(),
VALUES('Fact Growth'[Growth Fact]) = "Growth in employees last month",'Fact Growth'[Growth last month],
VALUES('Fact Growth'[Growth Fact]) = "Total employees sacked last month ",'Fact Growth'[sacked last month],
BLANK()
)
Any suggestion how i can improve/change the Measure A to add the if condition based on the two columns of Occupation tables?
Many thanks!
bar chart
slicer object with two measures
Occupation[Month] filter in bar chart
@rsanyoto , Try like
Measure A =
SWITCH( TRUE(),
max('Fact Growth'[Growth Fact]) = "Growth in employees last month",'Fact Growth'[Growth last month],
max('Fact Growth'[Growth Fact]) = "Total employees sacked last month ",'Fact Growth'[sacked last month],
BLANK()
)
or
Measure A =
sumx(values('Fact Growth'[Growth Fact]),
SWITCH( TRUE(),
max('Fact Growth'[Growth Fact]) = "Growth in employees last month",'Fact Growth'[Growth last month],
max('Fact Growth'[Growth Fact]) = "Total employees sacked last month ",'Fact Growth'[sacked last month],
BLANK()
))
hI @amitchandak ,
Thanks for your quick response. I have tested both of your proposals but the Bar chart that use the Measure A dont filter the right data.
fyi: this barchart uses has a default filter based on Occupation[Month].
My question to you is: is it right to keep this default filter on this barchart to let your proposals works? or should i delete Occupation[Month] on the filter visual?
Because the goal of the measure A needs is need to be "flexible" by showing the right data when a user click on one of the measure in the slicer visual.
User | Count |
---|---|
63 | |
59 | |
56 | |
38 | |
29 |
User | Count |
---|---|
82 | |
62 | |
45 | |
41 | |
40 |