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
dinesh_ch
Regular Visitor

pass slicer value to Filter inside CalculatedTable expression

Hello,

 

I have a table with below structure and slicer with MonthNum

 

Metric  MonthNum

10         1

40         2

70         3

100       4

20         5

 

Based on the selection of single slicer value, i need to get above table data having MonthNum less than or equal to slicer selected value.

If 3 is selected in slicer, i need to populate table dynamically as below

 

Metric  MonthNum

10         1

40         2

70         3

 

Tried with this DAX expression, but its not giving correct output.

DynamicTable = CALCULATETABLE('Actualtable',FILTER('Actualtable','Actualtable'[MonthNum] <= SELECTEDVALUE('Slicer'[MonthNum]))

 

Can you please help.

Thanks

1 ACCEPTED SOLUTION

Hi @dinesh_ch

 

Try these steps.

Please see attached file as well

 

 

First a calculated table which will be used as slicer

 

Months =
VALUES ( YourTable[MonthNum] )

 Now a MEASURE to be used as VISUAL filter

 

FilterMeasure =
IF (
    SELECTEDVALUE ( YourTable[MonthNum] ) <= SELECTEDVALUE ( Months[MonthNum] ),
    1
)

asds.png


Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

@dinesh_ch

 

Slicers do not affect calculated tables or calculated columns since these are computed when data is first loaded and are static until data is refreshed.

 

Try using MEASURES instead.


Regards
Zubair

Please try my custom visuals

Thanks for the response.

Can you please help me in formulatig the query using measure to achieve the functionality.

 

Hi @dinesh_ch

 

Try these steps.

Please see attached file as well

 

 

First a calculated table which will be used as slicer

 

Months =
VALUES ( YourTable[MonthNum] )

 Now a MEASURE to be used as VISUAL filter

 

FilterMeasure =
IF (
    SELECTEDVALUE ( YourTable[MonthNum] ) <= SELECTEDVALUE ( Months[MonthNum] ),
    1
)

asds.png


Regards
Zubair

Please try my custom visuals

Thank you so much Zubair. It worked.

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.