The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi, I'm a DAX newbie and I would like a calculated measure to change based on column value of Account. For example, if the "Account" number = 10002, then it should muliple the cost by the "Rate" and "VAT" and the rates it should change based on the "Account" number. I will be supplying the rates manually in the forumla so the additional "Rate" and "VAT" columns are of elaboration purposes. I tried something like below since I want this to have the same forumla for all accounts except for account 10002. Thank you all in advance!
AnnualTax =
VAR RateCalc =CALCULATE(SUMX(Table, Cost[Sum of Cost])
Return
CALCULATE(
(RateCalc*0.1836),
)
Account | Rate | VAT | Cost | Calculated Measure |
10001 | 18% | 6% | $1,000.00 | $ 1,000.00 |
10002 | 19% | 17% | $2,000.00 | =[Cost]*(1+[VAT])*[Rate] |
10003 | 20% | 20% | $3,000.00 | $ 3,000.00 |
Have you tried with an IF sentece?
This is like:
AnnualTax =
VAR RateCalc =CALCULATE(SUMX(Table, Cost[Sum of Cost])
Return
IF(Table[Account]="10002"]; RateCalc*(1+[VAT])*Rate; RateCalc)
)
Try using a calculated column instead using variable then. (I'm newbie too ^^)
This is: write a measure to calculate RateCalc
RateCalc := CALCULATE(SUMX(Table, Cost[Sum of Cost]))
Then, in a new column, use IF(Table[Account]="10002"]; RateCalc*(1+[VAT])*Rate; RateCalc)
yes I have. For some reason, the measure does not recognize the table/columns whe you type an IF statement after the VAR returns.