Forum Discussion
Creating new table in Direct query mode from existing one
- 6 years ago
Hi hari_krishnan ,
Have you tried instead of creating a new table, making a measure using a switch function and a table with the stages something similar to this:
Measure = SWITCH ( SELECTEDVALUE ( TableStage[Stage] ); "A"; CALCULATE ( COUNT ( Table[Name] ); Table[Gender] = 'M' ); "B"; CALCULATE ( COUNT ( Table[Name] ); Table[Age] = 20 ); ... )Can work as you need, because the measure are based on context and if they are calculated based on the initial table they will be filtered out by the dates.
Be aware that the Stage only needs to have A, B, C and so on without any relationship with the other table.
Hi hari_krishnan ,
Have you tried instead of creating a new table, making a measure using a switch function and a table with the stages something similar to this:
Measure =
SWITCH (
SELECTEDVALUE ( TableStage[Stage] );
"A"; CALCULATE ( COUNT ( Table[Name] ); Table[Gender] = 'M' );
"B"; CALCULATE ( COUNT ( Table[Name] ); Table[Age] = 20 );
...
)
Can work as you need, because the measure are based on context and if they are calculated based on the initial table they will be filtered out by the dates.
Be aware that the Stage only needs to have A, B, C and so on without any relationship with the other table.
MFelix Thanks a lot. This is working 😀
One more question, Does passing a measure works the same way as that of a column to the Custom Visual?
- MFelix6 years ago
Super User
Hi hari_krishnan ,
Not really sure if I understand what you mean by Custom Visual?
In any visualization you can add in the values columns or measures the difference is that columns are part of your model and measures are calculated on request so when you use the measure it calculate.
- hari_krishnan6 years ago
Helper I
Hi MFelix ,
By Custom Visual, I mean custom created visuals using the "PbiViz" library. A package provided my Microsoft to create custom charts.
- MFelix6 years ago
Super User
Hi hari_krishnan ,
On visualizations as I refer you can use columns or measures so no problem in using them on custom visualizations, be aware that the only thing regarding measures and visualizations is that they can only be used on the values and on filters not for example on axis or legends.