I have a created a measure table to to enable metric selection in visuals.
The table Measure_Select looks like this
MEASURE
Measure 1
Measure 2
I am using this table to create a Measure with a Switch function.
Select a Measure = SWITCH(FIRSTNONBLANK(Measure_Select[Select Measure], Measure_Select[Select Measure]), "Measure 1", SUM(Table[MetricName_Measure_1]),"Measure 2", SUM(Table[MetricName_Measure_2]))
The table and the measurement allow me now to create a slicer where a user can switch between these 2 metrics in a visual.
So far, so good.
In addition to those I have create a table where I define Time Periods for dates (e.g. "ThisMonth", "LastMonthToDate", etc.).
This is what I want to solve now. How can I create a Measure now that would bascially do the following:
Divide "Selected Measure for visual (e.g. Measure 1)" with Filter Value "ThisMonth" of Column "Period" by "Selected Measure for visual (e.g. Measure 1)" with Filter Value "LastMonthToDate" of Column "Period".
As far as I know, I cannot use CALCULATE or SUM because those don't support Created Measures.
Obviously, I want to use this formular to calculate the change in metric between two periods.
The challenge is that the measure changes based on the user input and there needs to be a variable. The measure table has 20 different measure names.