Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
jeongkim
Post Prodigy
Post Prodigy

Distinct dax with condition

Hi,

 

I'm getting unique values using Distinct to avoid duplicate list but can I add one conditon from its data table?

In the same table 'TOSS serivce PO_master - Append', there's another column 'Contract Amount' and I wanna take out which has value 0.

 

 

 

jeongkim_0-1742972942097.png

 

2 ACCEPTED SOLUTIONS
mdaatifraza5556
Super User
Super User

Hi @jeongkim 

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.

View solution in original post

Hi @jeongkim 

As i have tried with sample dataset

Dataset

Service No.Contract Amount
1015000
1027000
1030
1013000
1048000
1022000
1050
10612000
1074000
1080
1030
1043000
1095000

 

I have written the same DAX, and it return the result
Can you please recheck the DAX code you wrote?


 

mdaatifraza5556_0-1742978179403.png

 

View solution in original post

7 REPLIES 7
mdaatifraza5556
Super User
Super User

Hi @jeongkim 

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.

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 @jeongkim 

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.

jeongkim_0-1742975221598.png

 

Can you please take a look the error? 

Hi @jeongkim 

As i have tried with sample dataset

Dataset

Service No.Contract Amount
1015000
1027000
1030
1013000
1048000
1022000
1050
10612000
1074000
1080
1030
1043000
1095000

 

I have written the same DAX, and it return the result
Can you please recheck the DAX code you wrote?


 

mdaatifraza5556_0-1742978179403.png

 

oh this creating 2 columns in one go, right? 

Now it seems working great

Yes 

If I answer your questions, kindly accept it as a solution
If this is helpful then give kudos.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.