Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I want to use the Calculate with Selected value to return just one value, according to filters.
But my code doesn't work.
Below there is the DAX code and the data model
The result should be 01/08/2022, but instead, it returns BLANK.
Solved! Go to Solution.
Hi,
I am not sure how your datamodel looks like, but please try below whether it suits your requirement.
TEST measure: =
VAR _minvalor =
MINX (
FILTER (
ALLSELECTED ( 'DATABASE' ),
'DATABASE'[Data] >= DATE ( 2022, 1, 1 )
&& 'DATABASE'[Data] <= DATE ( 2022, 11, 1 )
&& 'DATABASE'[Tipo] = "REALIZADO/TOTAL"
),
'DATABASE'[Valor]
)
RETURN
MINX (
FILTER (
ALLSELECTED ( 'DATABASE' ),
'DATABASE'[Data] >= DATE ( 2022, 1, 1 )
&& 'DATABASE'[Data] <= DATE ( 2022, 11, 1 )
&& 'DATABASE'[Tipo] = "REALIZADO/TOTAL"
&& 'DATABASE'[Valor] = _minvalor
),
'DATABASE'[Data]
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
I am not sure how your datamodel looks like, but please try below whether it suits your requirement.
TEST measure: =
VAR _minvalor =
MINX (
FILTER (
ALLSELECTED ( 'DATABASE' ),
'DATABASE'[Data] >= DATE ( 2022, 1, 1 )
&& 'DATABASE'[Data] <= DATE ( 2022, 11, 1 )
&& 'DATABASE'[Tipo] = "REALIZADO/TOTAL"
),
'DATABASE'[Valor]
)
RETURN
MINX (
FILTER (
ALLSELECTED ( 'DATABASE' ),
'DATABASE'[Data] >= DATE ( 2022, 1, 1 )
&& 'DATABASE'[Data] <= DATE ( 2022, 11, 1 )
&& 'DATABASE'[Tipo] = "REALIZADO/TOTAL"
&& 'DATABASE'[Valor] = _minvalor
),
'DATABASE'[Data]
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |