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
Suhel_Ansari
Helper IV
Helper IV

Filter Column based on Selected Slicer Selection

Hi All,

I want to filter Column based on the selecte value from the Slicer, I have LastdayofMonth column and same as the slicer in Report canvas so when user select the date from slcier I want to filter selected Month along with the -12 Month from the selected Month, for example if the user select say 31/01/2021 then i need to filter the LastdayofMonth column for 31/12/2021 till 31/11/2020 I am using the below DAX as Measure but unable to get the final result. Please help. 

@amitchandak 

selectedValue = 

IF (
ISFILTERED ( v_DM_Dim_date[LastDayOfMonth] ) && HASONEVALUE ( v_DM_Dim_date[LastDayOfMonth] ),
LASTNONBLANK ( v_DM_Dim_date[LastDayOfMonth], 0 ),
1)

DAX.png

Regards

Suhel

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

Hi @Suhel_Ansari ,

 

You can try to create a separate date table for the slicer.

5.png

 

Try this measure

Measure = 
VAR StartDate =
    EOMONTH ( SELECTEDVALUE ( DateTable[Date] ), 0 )
VAR EndDate =
    EDATE ( EOMONTH ( SELECTEDVALUE ( DateTable[Date] ), -1 ), +12 )
RETURN
    IF (
        MAX ( 'MainTable'[Date] ) >= StartDate
            && MAX ( 'MainTable'[Date] ) <= EndDate
            && ENDOFMONTH ( 'MainTable'[Date] ) = MAX ( 'MainTable'[Date] ),
        1
    )

6.png

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @Suhel_Ansari ,

 

You can try to create a separate date table for the slicer.

5.png

 

Try this measure

Measure = 
VAR StartDate =
    EOMONTH ( SELECTEDVALUE ( DateTable[Date] ), 0 )
VAR EndDate =
    EDATE ( EOMONTH ( SELECTEDVALUE ( DateTable[Date] ), -1 ), +12 )
RETURN
    IF (
        MAX ( 'MainTable'[Date] ) >= StartDate
            && MAX ( 'MainTable'[Date] ) <= EndDate
            && ENDOFMONTH ( 'MainTable'[Date] ) = MAX ( 'MainTable'[Date] ),
        1
    )

6.png

 

You can check more details from here.

 

 

 

Best Regards,

Stephen Tao

 

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

@v-pn  Thank you for the Answer, it's works as expected. however i need a Solution without creating a Seperate Table can't we do it using only the Main Table. I need a solution for SSAS Model. Thanks

Ashish_Mathur
Super User
Super User

Hi,

Similar question answered here - Solved: Re: Calculate days past term need dropdown slicer.  Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Sorry it doen't work for my problem.

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.