Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
pasno
Helper II
Helper II

Use a calculated measure on another measure

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 🙂

 

 

 

 

 

 

1 ACCEPTED SOLUTION
VijayP
Super User
Super User

@pasno 

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




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


View solution in original post

4 REPLIES 4
VijayP
Super User
Super User

@pasno 

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




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Top, got it!

Thank you again!!!

VijayP
Super User
Super User

@pasno 

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!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

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))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors