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.
Hello,
I have tried the below code to find the earliest date on a graph's x axis...
VAR
MinimumAxisWeek = min(ALLSELECTED('Calendar - Days'[Calendar Date (week bins)]))
.... but I am getting the error below:
"The MIN function only accepts a column reference as an argument."
Please could someone point me in the right direction?
Thanks,
CM
Hi @CloudMonkey ,
The ALLSELECTED function gets the context that represents all rows and columns in the query, while keeping explicit filters and contexts other than row and column filters. You can also simply understand that the return value is a table.
Try to modify the formula like this:
MinimumAxisWeek = CALCULATE(MIN('table'[date]),ALLSELECTED('table'[date]))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
measure =
VAR
MinimumAxisWeek = minX(ALLSELECTED('Calendar - Days'),'Calendar - Days'[Calendar Date (week bins)])
return
MinimumAxisWeek
hi,
the error message is correct, sometimes you need to combine these simple dax functions to get what you want.
Use Min function to refer the date table, or column that you are using in your measure. But then use the CALCULATE function to change the filter context of your measure so that it takes into account the selected values, perhaps something like:
CALCULATE(MIN(Date[Date]), ALLSELECTED (Date[Date]))
(I haven't tested it out, but give it a go)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |