Forum Discussion
Earlier Function
Hi All,
Need your help to resolve one logic on dax.
Trying on DAX as below but getting error -"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value"
SWITCH( TRUE(), FILTER(OSMS_Recomit, OSMS_Recomit[OSMaterialRecoveryDate] = EARLIER(OSMS_Recomit[OSMaterialRecoveryDate])), "Same", FILTER(OSMS_Recomit, OSMS_Recomit[OSMaterialRecoveryDate] > EARLIER(OSMS_Recomit[OSMaterialRecoveryDate])),"Pushout", FILTER(OSMS_Recomit, OSMS_Recomit[OSMaterialRecoveryDate] < EARLIER(OSMS_Recomit[OSMaterialRecoveryDate])),"PullIn","NA" )
4 Replies
- MattAllingtonCommunity Champion
the formula looks fundamentally flawed to me. Lines 4-8 (the filter) return a table. But you are using switch true, so this section must return a true/false expression, not a table. The same applies to the other sections.
- FsciencetechHelper III
Hi Matt,
Thanks for your reply,
Suppose the IF condition, The below logic is not realted to DAX function, only explaing the logic that How can implement on DAX
If(OSMaterialRecoveryDate = Previous(OSMaterialRecoveryDate), "Same",
If(OSMaterialRecoveryDate > Previous(OSMaterialRecoveryDate), "Pushout",
If(OSMaterialRecoveryDate < Previous(OSMaterialRecoveryDate), "Pullin","NA")))
- MattAllingtonCommunity Champion
What do you mean by "Previous"? What are you trying to do? What tables and relationships do you have?
- v-deddai1-msftCommunity Support
Hi Fsciencetech ,
Use the followng measure based on your logic:
SWITCH(True(),OSMaterialRecoveryDate = Previous(OSMaterialRecoveryDate, "Same", OSMaterialRecoveryDate > Previous(OSMaterialRecoveryDate), "Pushout", OSMaterialRecoveryDate < Previous(OSMaterialRecoveryDate), "Pullin","NA")))If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai