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
SeHi
New Member

How to calculate a boolean column in DAX with specific filter

Hi all,

 

I have the following challange. My input table is:

 

KeyLabelsCluster
100redB
100whiteA
101whiteA
102redB
102blueC
102whiteA
103orangeA
104yellowA
104orangeA

 

I want to calculate an additional column ("Done by cluster A only?") in DAX which contains a boolean result

 

The result table shall look like:

 

KeyLabelsClusterDone by cluster A only?
100redB0
100whiteA0
101whiteA1
102redB0
102blueC0
102whiteA0
103orangeA0
104yellowA1
104orangeA1

 

Requirement is: Indentify the Cluster = A values where no other clusters are asigned to the same key. If cluster=A has multiple assignments to a single key (but no other clusters are assigned to this key), this should also return true.

 

Any suggestions to solve this in DAX?

 

Thanks for your support!

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @SeHi - create a calculated colum as below:

Done by cluster A only? =
VAR CurrentKey = 'clust'[Key]
VAR OtherClusters =
    CALCULATETABLE(
        DISTINCT('clust'[Cluster]),
        'clust'[Key] = CurrentKey,
        'clust'[Cluster] <> "A"
    )
RETURN
    IF(
        COUNTROWS(OtherClusters) = 0,
        1,
        0
    )

rajendraongole1_0-1720786618827.png

 

Hope it works.

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @SeHi - create a calculated colum as below:

Done by cluster A only? =
VAR CurrentKey = 'clust'[Key]
VAR OtherClusters =
    CALCULATETABLE(
        DISTINCT('clust'[Cluster]),
        'clust'[Key] = CurrentKey,
        'clust'[Cluster] <> "A"
    )
RETURN
    IF(
        COUNTROWS(OtherClusters) = 0,
        1,
        0
    )

rajendraongole1_0-1720786618827.png

 

Hope it works.

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.