Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I want to use a filter function In a calculate function with multiple filters how can I write this
CALCULATE(
[Sales],
KEEPFILTERS(
FILTER(
ALL('DimDate'),
DimDate[Date] > Date(2024,1,1)
-- want to add another filter below this for date is less than the end of January
)
)
Solved! Go to Solution.
Hi @akhaliq7 ,
Based on your problems, I think you can use the logical operators && (AND) or || (OR) to combine conditions.
Here's what I have done with your DAX code.
CALCULATE(
[Sales],
KEEPFILTERS(
FILTER(
ALL('DimDate'),
DimDate[Date] > Date(2024, 1, 1) &&
DimDate[Date] < Date(2024, 2, 1)
)
)
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @akhaliq7 ,
Based on your problems, I think you can use the logical operators && (AND) or || (OR) to combine conditions.
Here's what I have done with your DAX code.
CALCULATE(
[Sales],
KEEPFILTERS(
FILTER(
ALL('DimDate'),
DimDate[Date] > Date(2024, 1, 1) &&
DimDate[Date] < Date(2024, 2, 1)
)
)
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I am using the below as well what is more efficient?
CALCULATE(
[Sales],
KEEPFILTERS(DimDate[Date] > Date(2024, 1, 1)),
KEEPFILTER(DimDate[Date] < Date(2024, 2, 1))
)
User | Count |
---|---|
102 | |
88 | |
78 | |
71 | |
69 |
User | Count |
---|---|
113 | |
99 | |
97 | |
72 | |
68 |