Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I have a case where I have the following data:
There is a slicer based on the department. When Finance is selected in the slicer, another visual will display the comments related to finance. However, when no value is selected in the department slicer, the comments visual should show comments from Investment department.
Thank you,
Rehan
Solved! Go to Solution.
Hi @rschaudhr,
You should use a measure similar to the one below:
Comments selection =
IF (
ISFILTERED ( CommentsTable[Department] ),
SELECTEDVALUE ( CommentsTable[Comments] ),
CALCULATE (
SELECTEDVALUE ( CommentsTable[Comments] ),
FILTER (
ALL ( CommentsTable[Department], CommentsTable[Comments] ),
CommentsTable[Department] = "Investments"
)
)
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix ,
Thank you! It works very well. I should have mentioned earlier. This dax code very works well when you just select one department or there is no selection. It does not work when you select multiple selection. Is there a way to do that?
Thank you again for your help.
Hi @rschaudhr ,
You will need to create a independed department table and use it as slicer.
slicer = DISTINCT('Table'[DEP])
Then create a measure as below and add it to visual filter.
Measure = IF(ISFILTERED(slicer[DEP]),IF(SELECTEDVALUE('Table'[DEP]) in VALUES(slicer[DEP]),1,0),IF(SELECTEDVALUE('Table'[DEP])="INV",1,0))
Best Regards,
Jay
Hi @rschaudhr,
You should use a measure similar to the one below:
Comments selection =
IF (
ISFILTERED ( CommentsTable[Department] ),
SELECTEDVALUE ( CommentsTable[Comments] ),
CALCULATE (
SELECTEDVALUE ( CommentsTable[Comments] ),
FILTER (
ALL ( CommentsTable[Department], CommentsTable[Comments] ),
CommentsTable[Department] = "Investments"
)
)
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix ,
Thank you! It works very well. I should have mentioned earlier. This dax code very works well when you just select one department or there is no selection. It does not work when you select multiple selection. Is there a way to do that?
Thank you again for your help.
Hi @rschaudhr ,
What do you want when more than one is selected on the slicer? All of the values or just the first one?
If you want to concatenate all the values then you should use somethig similar to this one:
Comments selection =
IF (
ISFILTERED ( CommentsTable[Department] ),
CONCATENATEX(ALLSELECTED(CommentsTable[Comments],CommentsTable[Department]), CommentsTable[Comments], "/"),
CALCULATE (
SELECTEDVALUE ( CommentsTable[Comments] ),
FILTER (
ALL ( CommentsTable[Department], CommentsTable[Comments] ),
CommentsTable[Department] = "Investments"
)
)
)
Be aware that this gives you a text value with all the comments selected also if you have all the values selected on your slicer what works is the last syntax does not return only the Investment.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português@MFelix ,
So below are a few senario:
1) when no filter is selected in department slicer, only investment comment will show.
2) when HR filter is selected in department slicer, only HR comment will show.
3) when HR and IT filter is selected in department slicer, then HR and IT comments will show.
4) when HR, IT and Operation filter is selected in department slicer, then HR, IT and operation comments will show.
5) when All filter is selected in department slicer, then all comment will show.
I hope these senarios help.
Thank you!
Correct for all of them.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
81 | |
53 | |
37 | |
37 |