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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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!:
Mastering Power BI 2nd Edition

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!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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