Forum Discussion
Simple IF measure
- 6 years ago
hi Anonymous
is it really that complicated?
First, you should know that:
1. Calculation column/table not support dynamic changed based on filter or slicer.
2. Measure can be affected by filter/slicer, so you can use it to get dynamic summary result in a visual by its row context.https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/
Second, you could use this simple measure to get the result on it row context:
Measure = IF(SELECTEDVALUE('Table'[Commissionable]),SUM('Table'[Sales])*0.1)But this will lead a measure problem, See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376and this post:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907Now you will need to create another new measure as below
m_Total 1 = VAR __table = SUMMARIZE('Table1',[Company],[Commissionable],"__value",[m_Single]) RETURN SUMX(__table,[__value])Regards,
Lin
Anonymous ,
new table
summarize( table, Table[Company], "Commissions", sumx( Table, if([Commissionable] ="true",.1,0)*[Sales]))
new measure
sumx(summarize( table, Table[Company], "Commissions", sumx( Table, if([Commissionable] ="true",.1,0)*[Sales])),[Commissions])