Search code examples
pivot-tabledaxpowerpivotexcel-pivot

Pivot measure based on the pivot row label grouping


There is a table as shown in the pic

Is there a way to add a measure to the pivot created from the above data such that different error percentages can be used to different row label groups as shown in the pic?

If required I'm ready to do little bit of modification to the above source data, like adding some column or some calculation which should enable me to create such a measure but I'm really stuck here. Please help me out.


Update

Thanks to forums and members who constantly help people, I found out CONCATENATEX. So created three measures like below

Test_Group1=CONCATENATEX(GROUPBY(Range,Range[Group1]),LEFT(Range[Group1],1),"^")

Test_Group2=CONCATENATEX(GROUPBY(Range,Range[Group2]),LEFT(Range[Group2],1),"^")

Err=IF(SEARCH("^",[Test_Group2],1,0)=0,0.11,IF(SEARCH("^",[Test_Group1],1,0)=0,0.03,0.02))

Now Err is almost there but fails when single sub group items are there like in the pic. Tried to add dummy rows to the table by using UNION DAX function in the above measures but I'm missing something. Please help me out of this problem.


Solution

  • The answer is so simple. Please find the same in Power BI community forum.

    Err = IF(isinscope(Range[Group2]),0.11,IF(isinscope(Range[Group1]),0.03,0.02))