Best way to create and use constants in Power Pivot?

macfuller

Active Member
Joined
Apr 30, 2014
Messages
317
Office Version
  1. 365
Platform
  1. Windows
For my model I have constants to be applied such as projected inflation rate, depreciation years, and other values to be set by users as what-if options. There are too many variations the users want to create disconnected tables - e.g. listing every inflation rate by hundredths of a percent - resulting in huge lookup tables for 12-15 constants, so it's simpler to have a default table with values for each constant that I import into the model with Power Query.

Once the table is loaded however, I'm sure there must be a simpler way than I use to extract the value the user has entered so I can use it in calculations... I essentially do
Code:
Inflation Rate:= CALCULATE(MAX(DefaultTable[Value]), DefaultTable[Lookup] = "Inflation Rate")
then I can use the measure [Inflation Rate] in later formulas. This seems so convoluted that I'm hoping there's something blindingly obvious that I've missed.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I note that you're not using ALL? Try the general idea below:
<code style="background-color: rgb(239, 240, 241); border-bottom-color: rgb(36, 39, 41); border-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(36, 39, 41); border-left-style: none; border-left-width: 0px; border-right-color: rgb(36, 39, 41); border-right-style: none; border-right-width: 0px; border-top-color: rgb(36, 39, 41); border-top-style: none; border-top-width: 0px; box-sizing: border-box; font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif; font-size: 13px; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: 400; line-height: 16.9px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;">SalesMeasure = CALCULATE(SUM(Table1[Sale]), ALL(Table1[User]))
</code>
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,916
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top