Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello guys,
I need your help to proceed smoothly in my dashboard please!
I'm creating a new measure to use it inside my dashboard, and I'm calculating a dynamic date to select the count the right values I need.
Please have a look at hte following measure. It works correctly when i select the Date range using manual numbers to set year, month and day.
Result = CALCULATE(DISTINCTCOUNT('CostiRicaviTotale'[IDSpedizioneUnivoco]); ALL('MisurePersonalizzate'[ColonnaKW-1]); Calendario[Data]<=DATE(2021; 1; 31))
But I want to use a dynamic date range, so for example I made the following measure:
YearToUse = YEAR(TODAY())
Now, I want to insert my measure (YearToUse) inside the other measure (Result), to have a dynamic year value.
If I set the following code, I always get an error:
Result = CALCULATE(DISTINCTCOUNT('CostiRicaviTotale'[IDSpedizioneUnivoco]); ALL('MisurePersonalizzate'[ColonnaKW-1]); Calendario[Data]<=DATE(YearToUse; 1; 31))
Any help will be very appreciated, thank you in advance 🙂
Solved! Go to Solution.
You have Created a mesure YeartoUse separately and now you want to include in the measure
Instead of creating a separate mesaure you can create that measure by using Variables
VAR yeartouse = your Measure
and using RETURN syntax
you can use the Variance yeartouse in your final formula
Proud to be a Super User!
You have Created a mesure YeartoUse separately and now you want to include in the measure
Instead of creating a separate mesaure you can create that measure by using Variables
VAR yeartouse = your Measure
and using RETURN syntax
you can use the Variance yeartouse in your final formula
Proud to be a Super User!
Top, got it!
Thank you again!!!
you can use VAR (variable) within the Measure
https://docs.microsoft.com/en-us/power-bi/guidance/dax-variables
Please let me know if any further help required!
Proud to be a Super User!
Hello @VijayP
Thank you for the answer.
I had a look at the link, but I don't understand how can I convert my measure with VAR..
Result = CALCULATE(DISTINCTCOUNT('CostiRicaviTotale'[IDSpedizioneUnivoco]); ALL('MisurePersonalizzate'[ColonnaKW-1]); Calendario[Data]<=DATE(YearToUse; 1; 31))
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |