Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
I have a custom measure that produces a certain numeric value.
I have a slicer on the page for a range of values, say -20 to +10 for days that comes from a table & column
of a dimension table 'Days'[Days until sold]
What I want to do is remove the slicer from the page completely ( including removing other visual filters ) and include the code for it into my measure.
I had another DAX calculation I did that looks like this, but am unsure about how to incorprorate it into rhe existing code above
_NumberofValues
= CALCULATE(distinctcountnoblank('Mytable'[column]),
FILTER('Mytable',RELATED('Calendar'[month]) = 1))
Any help appreciated
Solved! Go to Solution.
Hi @wokka ,
If you want to remove the slicer from the page and instead embed its logic directly into your measure, you can do that by adding a FILTER condition inside your CALCULATE.
Assuming your slicer was filtering 'Days'[Days until sold] between -20 and +10, you can rewrite your measure like this:
_TheValue =
VAR ThisMonthValue = [Lines referred]
VAR GrandTotal =
CALCULATE(
SUM('Mytable'[MyColumn]),
FILTER(
'Days',
'Days'[Days until sold] >= -20 &&
'Days'[Days until sold] <= 10
)
)
VAR Endresult = GrandTotal * 0.25
RETURN
EndresultThis way, the filter is baked into the measure and you can safely remove the slicer from the report page.
If you also want to include something like your _NumberofValues logic, you can nest another CALCULATE or add it as a separate variable depending on how you want to use it in the final result.
Let me know if you want help combining both into one measure.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI
Thanks, thats great
Takin it a step further, if I wanted to include an additional second filter for a different table in the same code, how do you include that please in your code above? That way I can remove all slicers and filters from the page and create very specific filters based on many different coded-in filters.
Thank you
Hi @wokka ,
If you want to remove the slicer from the page and instead embed its logic directly into your measure, you can do that by adding a FILTER condition inside your CALCULATE.
Assuming your slicer was filtering 'Days'[Days until sold] between -20 and +10, you can rewrite your measure like this:
_TheValue =
VAR ThisMonthValue = [Lines referred]
VAR GrandTotal =
CALCULATE(
SUM('Mytable'[MyColumn]),
FILTER(
'Days',
'Days'[Days until sold] >= -20 &&
'Days'[Days until sold] <= 10
)
)
VAR Endresult = GrandTotal * 0.25
RETURN
EndresultThis way, the filter is baked into the measure and you can safely remove the slicer from the report page.
If you also want to include something like your _NumberofValues logic, you can nest another CALCULATE or add it as a separate variable depending on how you want to use it in the final result.
Let me know if you want help combining both into one measure.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 82 | |
| 48 | |
| 36 | |
| 31 | |
| 29 |