Forum Discussion
DAX function returns blank in card
Hi,
Could anyone please clarify why the following measure returns "Blank".
Running chassis matching with F =
VAR overallmax = [Overall max pallet positions per 3hr bucket]
VAR maxpalletoccuredday =
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
VALUES ( 'Calendar'[Date] ),
[Max Pallet positions per day] = overallmax
)
)
VAR maxpalletoccuredbucket =
CALCULATE (
MAX ( 'Time Buckets'[Bucket] ),
FILTER (
VALUES ( 'Time Buckets'[Bucket] ),
[New Pallet requirement] = overallmax
)
)
RETURN
maxpalletoccuredbucket
I doubt that, the max worked for date. But the second time, the max is applied on data type text.
I am not sure that max fits in here. Could anyone lists the dax function that results a single value similar to max but not arithmatic function.
Thanks
7 Replies
- vissvess
Helper V
In short, I am in need of finding the value that corresponds to max value of a measure.
In detail,
I have a measure which returns a particular value.
I want to get the particular field value which corresponds to the max of measure output.I am not well in dax. So, feel free to neglect my code in case and propose new code.
Any help would be so thankful.
Thanks in advance.
- AnonymousNot applicable
Running chassis matching with F = VAR __overallMax = [Overall max pallet positions per 3hr bucket] VAR __maxPalletOccuredBucket = FILTER ( VALUES ( 'Time Buckets'[Bucket] ), [New Pallet requirement] = __overallMax ) RETURN __maxPalletOccuredBucketYou can try the above but since I can't see the model, don't know the measures used and don't really know what the code does in the context you try to use it in, I can't be of more help. FILTER should return one value. If it returns more, then you'll get an error.
Best
Darek
- vissvess
Helper V
Dear Anonymous ,
The code worked great. As mentioned by you. There is a one time occurance of the max value. So the code doesnot returned an error.
But could you please clarify, what to do if I get an error in future as the dataset may get updated, so that there are two field values with the max. What to do to get the any one or latest or both in the list that to be used for slicer.
Please extend your kind help further.
Thanks
- AnonymousNot applicableIf you get 2+ time buckets, then you have to decide what rule you want to apply to get one of them as the value of your measure. It's your choice. I can't help you with this. All I can do is try to figure out how to implement rules and algorithms. I can't create them for you.
Best
Darek