Problem with creating measures for unique values in a column #1417
Unanswered
SimonAnalyst
asked this question in
🙋♀️TE3 Q&A
Replies: 1 comment
-
|
Am I assuming correctly that you want to create a C# script to do this? I'm curious to hear what you've tried so far. In any case, something like the following should work: var dataReader = ExecuteReader("EVALUATE DISTINCT(FactTable[Prod Realization])");
while(dataReader.Read())
{
var value = dataReader.GetString(0);
Model.Tables["FactTable"].AddMeasure(
// Name of measure:
"Realization " + value,
// DAX expression:
"CALCULATE(SUM([FactTable[ActualsYTD]), FactTable[Prod Realization] = \"" + value + "\")"
);
}I tested the script on the AdventureWorks model, using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying to create measures dynamically in Tabular Editor for each unique value in the column FactTable[Prod Realization]. I want to create a measure that sums the values in FactTable[ActualsYTD], with a filter applied for each unique value in FactTable[Prod Realization].
The goal is to generate a measure for each unique value in FactTable[Prod Realization], calculating the sum of FactTable[ActualsYTD] filtered by that value.
Can anyone point out what might be going wrong or suggest a solution to ensure only the correct unique values generate measures?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions