Forum Discussion
Anonymous
8 years agoNot applicable
Dynamic Measure Selection and YOY Calculation
Hello, I am fairly new to Dax and M langauage, but I have mananged to throw a report together that works, but it is missing some dyamic features(Please forgive any terminologies that are incorrec...
- 8 years ago
Hi,
Yes, you will have to write that formula for each measure.
Greg_Deckler
8 years agoCommunity Champion
In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563
Anonymous
8 years agoNot applicable
Thank you for your response! I appreciate you reponse. Just to confirm my code's reasoning would be:
Measures to Show =
IF(
// This first IF condition forces the measure to evaluate in the context of the visual
HASONEVALUE(Employees[Employee]), Is this repeated for each columun? In my case the each measure is a column before I switch
the measure to rows for the table visual (Contact c is table name in the table above).
Example: HASONEVALUE(ContactC[Total Contacts],
HASONEVALUE(ContactC[Total CPH],
// This next condition avoids getting the error that the visual cannot be displayed
IF(HASONEVALUE(Attendance[Attendance]), I assume this is a the disconnected table created with the names of all the measures( I will name it MeasureC).
// This switch statement uses the values from our Attendance slicer to determine which measure to display
SWITCH(
VALUES(Attendance[Attendance]), Should the values for MeasureC be an index or does this just refer to the names of all the measures?
"Attended",[Attended], Here I just reapeat each measure again I assume it refers to the names.
"Not Attended",[NotAttended]
),
// If the Attendance slicer has not been selected, just display the date of the training
MAX([Date])
)
)
I guess I am having a hard time seeing how the disconnected table connects to the table I just in the previous post without having to rewrite the formulas of the calculated measure.
Once again thanks for the repsonse. I have been trying to figure this out for a while now.