Forum Discussion
ABS Function not accepting column name
Hello Anonymous,
Can you please tell exactly what is your requirement? Also, are you using this DAX in a calculated measure?
Because calculated won't just have column names without any aggregation in their calculation.
- Anonymous6 years agoNot applicable
How to implement this SQL Statement in Power BI ?
I am trying to create a measure for this because with this query , I will be getting a numerical figure that I will have to populate in a card on power bi dashboard.
SQL:
ROUND(MEDIAN(CASE WHEN CHALLENGERESULT = 'ABC' AND PRIORPRICE <> 0 AND CREATEDTIMESTAMP BETWEEN TRUNC(TO_DATE($P{DATE_STR},'DD-MON-YYYY'))- 8 AND TRUNC(TO_DATE($P{DATE_STR},'DD-MON-YYYY')) THEN ((ABS(POSTPRICE-PRIORPRICE))/PRIORPRICE)*100 ELSE NULL END),2) - ROUND(MEDIAN(CASE WHEN CHALLENGERESULT = 'ABC' AND PRIORPRICE <> 0 AND CREATEDTIMESTAMP BETWEEN TRUNC(TO_DATE($P{DATE_STR},'DD-MON-YYYY'))- 15 AND TRUNC(TO_DATE($P{DATE_STR},'DD-MON-YYYY'))- 8 THEN ((ABS(POSTPRICE-PRIORPRICE))/PRIORPRICE)*100 ELSE NULL END),2) "W Magnitude Trend"
CREATEDTIMESTAMP : Date Time column in my table
CHALLENGERESULT : Column in my table and i have 3 types of values in this column ('ABC', 'DEF', 'OTHERS')
PRIORPRICE : Column in my table that contains some numerical figure
POSTPRICE : Column in my table that contains some numerical figure
In the $P{DATE_STR}, user is entering the date
I think now the requirement is clear, if you still need any type of clarification then please message me.
Thanks !