Hello friends, Hope all is well!
Please help me with the below DAX formula.
Trying to have the OR function applied. So if the field has either the word "Pharma" or "Hosp." then resume.
the below formula needs editing please.
= CALCULATE(sum([amount]), FILTER( 'AP-RAW',[Hosp / Pharma]="Pharma"&&[Hosp / Pharma]="Hosp."&&[TRANSACTION_TYPE_NAME]=earlier([TRANSACTION_TYPE_NAME])&&[DESCRIPTION]=EARLIER([DESCRIPTION])))
Thank you so much in advance!
Can't test it but the && logical operator equals an AND. Since you seem to need an OR, use || (a double pipe).
More on that in the link below.
https://learn.microsoft.com/en-us/dax/dax-operator-reference
You can also use the IN operator when you want to use OR logic.
= CALCULATE(
sum([amount]),
FILTER(
'AP-RAW',
[Hosp / Pharma] IN {"Pharma" , "Hosp."} && [TRANSACTION_TYPE_NAME]=earlier([TRANSACTION_TYPE_NAME]) && [DESCRIPTION]=EARLIER([DESCRIPTION]
)
)
)
Regards
Phil