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

Using a slice selection for measure but not for filtering

Hi,

I am working with a power Bi that consists on comparing the user data from one month to the previous one. To do this, i can't use a slice to make the user choose the month because then i have to options:

- if I allow the slice to filter the visual object, I don't have the data from the previous month of the selected one (for exemple if user select april, I can't show the comparision with march because data is filtered only by march).

- If I don't filter the visual object by the slice but I use the value selected with the SELECTEDVALUE() function, it doesn't take it because it is not filtered by it.

 

If thought in using two slices, that the one depending in the other (it could be that the segond filter took the previous month to the one selected in the first slice or something like this).

 

If you guys have some ideas on it I would be very thankful.

 

Kind regards,

Marc

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Please check if the new field parameters can help

Field Parameters- One solution for Measure Dimension slicer: https://youtu.be/lqF3Wa1FllE?t=70

 

also check

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

View solution in original post

v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, you said that if you allow the slicer to filter the visual, you don't have the data from the previous month of the selected one. But if you create a measure to show the previous month data, it can also work fine with the slicer.

I create a sample.

vkalyjmsft_0-1654063506578.png

Here's my solution, create a measure.

Pre =
VAR _Pre =
    DATEADD ( 'Table'[Date], -1, MONTH )
RETURN
    CALCULATE (
        MAX ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = _Pre )
    )

Get the correct result.

vkalyjmsft_1-1654063786788.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, you said that if you allow the slicer to filter the visual, you don't have the data from the previous month of the selected one. But if you create a measure to show the previous month data, it can also work fine with the slicer.

I create a sample.

vkalyjmsft_0-1654063506578.png

Here's my solution, create a measure.

Pre =
VAR _Pre =
    DATEADD ( 'Table'[Date], -1, MONTH )
RETURN
    CALCULATE (
        MAX ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] = _Pre )
    )

Get the correct result.

vkalyjmsft_1-1654063786788.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

amitchandak
Super User
Super User

@Anonymous , Please check if the new field parameters can help

Field Parameters- One solution for Measure Dimension slicer: https://youtu.be/lqF3Wa1FllE?t=70

 

also check

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

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.