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
JustinDoh1
Post Prodigy
Post Prodigy

How to create a slicer based on columns or measures

(I have updated this post from original.) 

 

I am sharing my Pbix file here.

I am trying to create a slicer that selects visual presentation based on three measures or calculation of four columns.

 

Option for slicer:

  1. OT
  2. DT
  3. Total (sum of OT & DT)

 

OT = sum of [ot_hrs1] & [ot_hrs2]

DT = sum of [dt_hrs1] & [dt_hrs2]

Total = sum of OT & DT

 

I have four columns as shown below:

JustinDoh1_0-1632508877051.png

 

I went ahead and created three measures based on these four columns.

Top line graph is based on using three measures, and bottom one is using newly created three columns:

 

JustinDoh1_0-1632508711037.png

But, I think in order to use values for slicer, it has to be in column, not measure (right?).

 

Please let me know.

 

Thanks for help.

 

 

1 ACCEPTED SOLUTION

@v-yetao1-msft Thank you for your help.

I reviewed the two links you mentioned, and I am still struggling with how I should a link a slicer table with the measure.

I opend up a new post with updated Pbix file.

View solution in original post

4 REPLIES 4
v-yetao1-msft
Community Support
Community Support

Hi @JustinDoh1 

I found two similar cases, you can refer to their operations .

https://community.powerbi.com/t5/Desktop/how-to-get-the-column-name-in-slicer/td-p/817982

https://community.powerbi.com/t5/Desktop/Slicer-by-columns-name/td-p/228370

If you can, I still recommend that you operate in Power Query with Unpivot , which is a bit simpler than in DAX .

 

Best Regards

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yetao1-msft Thank you for your help.

I reviewed the two links you mentioned, and I am still struggling with how I should a link a slicer table with the measure.

I opend up a new post with updated Pbix file.

Greg_Deckler
Super User
Super User

@JustinDoh1 If you unpivot your 4 columns in Power Query the solution becomes trivial. Is that a possibility?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Sorry. it has to be done in PowerBI, not in Excel (Power Query). 

I also updated the original post with updated PBIX file here.

Actually, the requirement has been changed since the original post that I need to express in three options:

1. ot_hrs1 + ot_hrs2 = OT

2. dt_hrs1 + dt_hrs2 = DT

3. All four

 

I have updated the original post with more detailed (using Measures vs. Columns).

What is solution here? 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.