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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
benkenten
Regular Visitor

Creating Boolean column based on other columns (exists in SQL)

Hi all 

 

Very new to PBI, I have two columns (JournalID and Reversing), with data. I want to create a third column, InReversing, that will evaluate to True, because there is minimum 1 Reversing within the JournalID (sample data below).

 

In SQL this is easy using Group By and Exists. I don't know how to start this with DAX/PQ. Can anyone help?

 

JournalIDReversingInReversing?
ABCTrueTrue
ABCFalseTrue
DEFFalseFalse
DEFFalseFalse
1 ACCEPTED SOLUTION
Kishore_KVN
Super User
Super User

Hello @benkenten ,

I can suggest one approach for this problem. Create two columns and make sure to change the datatype of True/False column into Text before creating these two columns.

DAX for Column 1 will be: 

Numbering = IF(Data[Reversing]="True",1,0)

DAX for Column 2 will be:

Result = 
Var A = CALCULATE(SUM(Data[Numbering]),ALLEXCEPT(Data,Data[JournalID]))
Return
If(A>0,"True","False")

Output looks like this:

Kishore_KVN_0-1685730200428.png

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

 

View solution in original post

2 REPLIES 2
Kishore_KVN
Super User
Super User

Hello @benkenten ,

I can suggest one approach for this problem. Create two columns and make sure to change the datatype of True/False column into Text before creating these two columns.

DAX for Column 1 will be: 

Numbering = IF(Data[Reversing]="True",1,0)

DAX for Column 2 will be:

Result = 
Var A = CALCULATE(SUM(Data[Numbering]),ALLEXCEPT(Data,Data[JournalID]))
Return
If(A>0,"True","False")

Output looks like this:

Kishore_KVN_0-1685730200428.png

 

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

 

tamerj1
Super User
Super User

Hi @benkenten 

please try

InReversing =
TRUE
IN CALCULATETABLE (
VALUES ( 'Table'[Reversing] ),
ALLEXCEPT ( 'Table', 'Table'[JournalID] )
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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