Forum Discussion
cyberirbis
4 years agoFrequent Visitor
Dynamic calculation based on filter and grouping
Hi all I have measure formula like divide(SUM('Table1'[Col1]),SUM('Table1'[Col2])+SUM('Table2'[Col3]) ,0) Problem is with 'Table2'[Col3] field - it should be excluded from formula in case if...
amitchandak
4 years agoSuper User
cyberirbis , Try like
VAR compValue = maxx(filter(allselcted('Table3'),'Table3'[Attr1]= "Total"),'Table3'[Attr1])
RETURN
SWITCH(
compValue,
"Total", divide(SUM('Table1'[Col1]),SUM('Table1'[Col2])+SUM('Table2'[Col3]) ,0),
divide(SUM('Table1'[Col1]),SUM('Table1'[Col2]) ,0)
)
cyberirbis
4 years agoFrequent Visitor
sorry, I don't get what this expression for:
VAR compValue = maxx(filter(allselcted('Table3'),'Table3'[Attr1]= "Total"),'Table3'[Attr1])
This will not work at all since 'Table3'[Attr1] is integer
In my example
VAR compValue = SELECTEDVALUE(Table3'[Attr1],"Total")
"Total" it's not value of 'Table3'[Attr1] field, it's just value to identify total row with several 'Table3'[Attr1] values for further using in switch function