Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
wokka
Helper IV
Helper IV

How to pass custom Measure value to table filter via DAX

I have an existing table that has a date filter that I have set up manually.

 

What I want to do is pass a value from a custom measure ( a single month number of 1 or 2 etc up to 12 )

to the existing filter thats on the table.

 

When I run the performance analyzer, I can see the date value in the DAX code for the table   :

 


    VAR __DS0FilterTable2 =
        TREATAS({DATE(2024, 3, 1)}, 'Calendar'[month])
 
 
If I had a custom measure called [Custom_month] that produced say a numeric value of "2" for the month
how would I modify the code above to replace the "3" with a "2" from the custom measure please?
 
Also, if I create dax and run it in DAX query view against the model, will it store the DAX code forever in the model?
 
Thanks in advance.
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a calculation group to apply the filter. Create a couple of calculation items like

No Change = SELECTEDMEASURE()

and

Add custom filter =
CALCULATE (
    SELECTEDMEASURE (),
    TREATAS ( { DATE ( 2024, [Custom_month], 1 ) }, 'Calendar'[month] )
)

Then add the calculation group as a filter on the visuals you want to be affected, and choose "Add custom filter" as the only value.

With regards to DAX in DAX Query View, the query will be stored whenever you save the file. If you publish it to the service and then subsequently download it, the query will still be available.

View solution in original post

4 REPLIES 4
v-saisrao-msft
Community Support
Community Support

Hi @wokka,

 

We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @wokka,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @wokka,
I wanted to check if you had the opportunity to review the information provided by @johnt75 . Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

johnt75
Super User
Super User

You could create a calculation group to apply the filter. Create a couple of calculation items like

No Change = SELECTEDMEASURE()

and

Add custom filter =
CALCULATE (
    SELECTEDMEASURE (),
    TREATAS ( { DATE ( 2024, [Custom_month], 1 ) }, 'Calendar'[month] )
)

Then add the calculation group as a filter on the visuals you want to be affected, and choose "Add custom filter" as the only value.

With regards to DAX in DAX Query View, the query will be stored whenever you save the file. If you publish it to the service and then subsequently download it, the query will still be available.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.