Forum Discussion
cyborgandy
2 years agoHelper II
DAX for same number
Hi All,
I have below dataset in my power bi dax, I want to write a dax for new column which should give matched or unmatched text in new column, I want new columns to match month and company name along with the spend. I want - vlaue to matched with +ve value for same company and month
| Month | Company | Spend | Validation |
| Jan | ABC | -5000 | Matched |
| Feb | ABC | 4000 | Unmatched |
| Jan | ABC | 5000 | Matched |
| Feb | ABC | 5000 | Unmatched |
| Jan | XYZ | -1000 | Matched |
| Feb | XYZ | 2000 | Unmatched |
| Jan | XYZ | -1000 | Matched |
| Feb | XYZ | 3000 | Unmatched |
HI, cyborgandy
try below code for new columnColumn = var a = 'Table'[Month] var b = 'Table'[Company] var c = ABS('Table'[Spend]) var final= CALCULATE( COUNTROWS('Table'),'Table'[Month]=a,'Table'[Company]=b,ABS('Table'[Spend])=c ) return IF(final=1,"unmatched","matched")
3 Replies
- IdrissshatilaSuper User
- cyborgandyHelper II
Expected outcome column is already added as Validation column the snapshot I mentioned
- Dangar332Resident Rockstar
HI, cyborgandy
try below code for new columnColumn = var a = 'Table'[Month] var b = 'Table'[Company] var c = ABS('Table'[Spend]) var final= CALCULATE( COUNTROWS('Table'),'Table'[Month]=a,'Table'[Company]=b,ABS('Table'[Spend])=c ) return IF(final=1,"unmatched","matched")