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

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.

Reply
loganwol
Employee
Employee

How do I define a value that can be used as a constant in multiple places (like measures)

Hi,

 

I'm looking to use a constant value (which is a date) that i can edit and update so that I can change my report to only show data relevant to Today - (Constant Value).

Bit of context, I have a report for current candidates hiring and their respective status in the "queue". I periodically send out the report (every week but sometimes it might becomes the last 10 days). I have a few measures such as total number of candidates which is easy but I also have some measures that has to show number of incoming candidates in the last n days. Right now I end up manually editing the measure to a specific value and have realized I forget one of the places at least.

I thought I can create a manual table with the value and then update it but soon realized that manually created tables in PBI are not updateable.

Any other way to accomplish this?

 

Regards 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Just create a measure like this:

 

TheAnswertotheUltimateQuestionofLifetheUniverseandEverything = 42

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-haibl-msft
Employee
Employee

@loganwol

 

I think you can also do it with Query Parameters. I’d like to give a simple sample. I assume we have a table like below.

How do I define a value that can be used as a constant in multiple places (like measures)_1.jpg

 

We can create a parameter and enable load to make it available to be referenced later.

How do I define a value that can be used as a constant in multiple places (like measures)_2.jpg

 

Now we can create a measure with following formula. And the parameter can be edited later.

UsersForCurrentDate = 
CALCULATE (
    SUM ( Table1[users] ),
    FILTER ( Table1, Table1[Date] = VALUES ( Parameter1[Parameter1] ) )
)

How do I define a value that can be used as a constant in multiple places (like measures)_3.jpg

 

Best Regards,

Herbert

Interesting, I was looking to use the query parameters. The Enable load flag was the part i was missing. Will give it a try.

Greg_Deckler
Super User
Super User

Just create a measure like this:

 

TheAnswertotheUltimateQuestionofLifetheUniverseandEverything = 42

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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