The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I've been trying to do something that looks simple but still couldn't find any answers to:
I have 2 columns A and B and I'm calculating a measure using both. What should I do if I wanted the user to be able to click a button (or buttons) to make it possible for the measure to be computed for different scenarios according to the button selected, e.g. using:
- only the values of column A or
- only the values of column B or
- both columns
Thank you in advance!
Solved! Go to Solution.
Hi @Anonymous
You can create a slicer with the options. A one-column table:
SlicerTable
Option 1
Option 2
Option 3
The user can then select the option in the slicer. Your measure would read the contents of the slicer and perfomr the required calculation based on it. Something like:
Measure =
SWITCH (
SELECTEDVALUE ( SlicerTable[Option] ),
"Option 1", SUM(Table1[Col A]),
"Option 2", SUM(Table1[Col B]),
"Option 3", SUM(Table1[Col A]) + SUM(Table1[Col B])
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @Anonymous
You can create a slicer with the options. A one-column table:
SlicerTable
Option 1
Option 2
Option 3
The user can then select the option in the slicer. Your measure would read the contents of the slicer and perfomr the required calculation based on it. Something like:
Measure =
SWITCH (
SELECTEDVALUE ( SlicerTable[Option] ),
"Option 1", SUM(Table1[Col A]),
"Option 2", SUM(Table1[Col B]),
"Option 3", SUM(Table1[Col A]) + SUM(Table1[Col B])
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
User | Count |
---|---|
69 | |
64 | |
62 | |
55 | |
28 |
User | Count |
---|---|
203 | |
82 | |
65 | |
48 | |
38 |