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
Anonymous
Not applicable

Category report slicer based on measures

Hi Community,

My dataset looks like following:

 

StaffHrs1Hrs2Hrs3Hrs4Hrs5Hrs 6
A147148
B235235
C093093
D782784
E657659
F277277
       

I created following measures:

Indv Hrs = Hrs1+ Hrs3+ Hrs4
Group Hrs Hrs2+ Hrs5+ Hrs6

On the report I have following table:

 

StaffIndv HrsGroup Hrs
A916
B911
C321
D1620
E1919
F1121

 

I want to include a slicer at the top of the report that provides selection of 'Indv Hrs' & 'Group Hrs'. If I do so by including the above two measures on the slicer it comes up with all the calulations. I want just the categories 'Indv Hrs' & 'Group Hrs' listed on the slicer. Based on the selection Indv Hrs or Group Hrs show respectively.

Please suggest how can I achieve this.

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

Slicer:

c2.png

 

You may create a measure as below.

Result = 
SWITCH(
    SELECTEDVALUE(Slicer[Category]),
    "Indv Hrs",
    SUM('Table'[Hrs1])+SUM('Table'[Hrs3])+SUM('Table'[Hrs4]),
    "Group Hrs",
    SUM('Table'[Hrs2])+SUM('Table'[Hrs5])+SUM('Table'[Hrs 6])
)

 

Finally you need to use the matrix visual to display the result.

c3.png

 

Best Regards

Allan

 

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

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Table:

c1.png

 

Slicer:

c2.png

 

You may create a measure as below.

Result = 
SWITCH(
    SELECTEDVALUE(Slicer[Category]),
    "Indv Hrs",
    SUM('Table'[Hrs1])+SUM('Table'[Hrs3])+SUM('Table'[Hrs4]),
    "Group Hrs",
    SUM('Table'[Hrs2])+SUM('Table'[Hrs5])+SUM('Table'[Hrs 6])
)

 

Finally you need to use the matrix visual to display the result.

c3.png

 

Best Regards

Allan

 

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

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.