Forum Discussion
Distinct dax with condition
- 1 year ago
Hi Anonymous
Can you please try the below DAX?
VAR FilteredTable = FILTER(
'TOSS service PO_master - Append',
'TOSS service PO_master - Append'[Contract Amount] <> 0
)
RETURN DISTINCT(SELECTCOLUMNS(FilteredTable, "Service No", 'TOSS service PO_master - Append'[service no]))
If this answers your questions, kindly accept it as a solution.
If you found this helpful, then give kudos. - 1 year ago
Hi Anonymous
As i have tried with sample dataset
DatasetService No.Contract Amount 101 5000 102 7000 103 0 101 3000 104 8000 102 2000 105 0 106 12000 107 4000 108 0 103 0 104 3000 109 5000 I have written the same DAX, and it return the result
Can you please recheck the DAX code you wrote?
It works thanks!
Can we create Contract Amount column with your code?
Lookupvalue dax not working cuz it only get 1 First or Last value but I wanna get Sum of 'Contract Amount' from 'TOSS service PO_master - Append' table into current Distinct table using same 'Service No.'
Hi Anonymous
Can you please try this?
VAR FilteredTable =
FILTER(
'TOSS service PO_master - Append',
'TOSS service PO_master - Append'[Contract Amount] <> 0
)
RETURN
ADDCOLUMNS(
DISTINCT(SELECTCOLUMNS(FilteredTable, "Service No", 'TOSS service PO_master - Append'[service no])),
"Total Contract Amount",
CALCULATE(
SUM('TOSS service PO_master - Append'[Contract Amount]),
ALLEXCEPT('TOSS service PO_master - Append', 'TOSS service PO_master - Append'[service no])
)
)
If this answers your questions, kindly accept it as a solution.
If you found this helpful, then give kudos.
- Anonymous1 year agoNot applicable
Can you please take a look the error?
- mdaatifraza55561 year agoSuper User
Hi Anonymous
As i have tried with sample dataset
DatasetService No.Contract Amount 101 5000 102 7000 103 0 101 3000 104 8000 102 2000 105 0 106 12000 107 4000 108 0 103 0 104 3000 109 5000 I have written the same DAX, and it return the result
Can you please recheck the DAX code you wrote?- Anonymous1 year agoNot applicable
oh this creating 2 columns in one go, right?
Now it seems working great