Forum Discussion
samc_26
Helper IV
2 years agoRow level filter with calculation
Hi all, I have a table with a list of costs against different people but for one person I want to give them a 50% discount, in this case I'll use Charlie as the chosen one! So I want the £200 to stay...
Dangar332
Resident Rockstar
2 years agohi, samc_26
try below measure
just adjust your table name and column name
Measure =
var a = SELECTEDVALUE('Table (3)'[name])
var b = SUMX( FILTER( 'Table (3)' ,'Table (3)'[name]=a),'Table (3)'[charge])
var c = b* (50/100)
var d = CALCULATE(SUM('Table (3)'[charge]),ALL())
return
IF(ISINSCOPE('Table (3)'[name]),MIN('Table (3)'[charge]),d-c)
check as you need
- samc_262 years ago
Helper IV
Hi, thank you for taking the time to post this, I have tried to use it but I can't work out how the code filters to just the name 'Charlie'? When I put the measure in a card it shows a figure of 2.89M when I'm looking for about 11k so not sure what's happened!
- Dangar3322 years ago
Resident Rockstar
hi, samc_26
i made code for dynamic user selection
for only charlie
try below code
Measure = var b = SUMX( FILTER( 'Table (3)' ,'Table (3)'[name]="charlie"),'Table (3)'[charge]) var c = b* (50/100) var d = CALCULATE(SUM('Table (3)'[charge]),ALL()) return IF(ISINSCOPE('Table (3)'[name]),MIN('Table (3)'[charge]),d-c)