Forum Discussion
Dynamic Measure based on the selected filter - Hierarchical data
- 6 years ago
Hi smerchantkitab ,
I create a sample. Please have a try to check if it is what you want.
- Create a new table and use the columns as slicer.
Table 2 = SELECTCOLUMNS('Table',"h1",'Table'[h1],"h2",'Table'[h2])- Create a measure.
Measure = var h1 = CALCULATE(SUM('Table'[h1_i_cnt]),FILTER('Table','Table'[h1] = SELECTEDVALUE('Table 2'[h1]))) var h2 = CALCULATE(SUM('Table'[h2_i_cnt]),FILTER('Table','Table'[h2] = SELECTEDVALUE('Table 2'[h2]))) return IF(HASONEVALUE('Table 2'[h2]),h2,IF(HASONEVALUE('Table 2'[h1]),h1,0))For more details, please see the attachment.
Thanks. Here is the dataset with desire results. I don't know if you can see but based on the filter I am picking up the data from appropriate level column. so if A.3 is selected I should get h2_i_cont corresponding value.
Updated: AllisonKennedy Basically, I have four cards but I need a single measure which returns the value from the corresponding column for the selected level (slicer).
Hi smerchantkitab ,
I create a sample. Please have a try to check if it is what you want.
- Create a new table and use the columns as slicer.
Table 2 = SELECTCOLUMNS('Table',"h1",'Table'[h1],"h2",'Table'[h2])
- Create a measure.
Measure =
var h1 = CALCULATE(SUM('Table'[h1_i_cnt]),FILTER('Table','Table'[h1] = SELECTEDVALUE('Table 2'[h1])))
var h2 = CALCULATE(SUM('Table'[h2_i_cnt]),FILTER('Table','Table'[h2] = SELECTEDVALUE('Table 2'[h2])))
return
IF(HASONEVALUE('Table 2'[h2]),h2,IF(HASONEVALUE('Table 2'[h1]),h1,0))
For more details, please see the attachment.
- smerchantkitab6 years agoFrequent Visitor
I used another technique to resolve this issue. I can create a calculated column based on the level so if 1.0.0.0. This is level one. 1.1.0.0 leve two etc then created a measure which gives me a figure based on the level selected.
Thanks