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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
CJ_96601
Helper V
Helper V

Distinct count from two column if either statement is true

Distinct count from two column if either statement is true.  

 

you may refer to below table - result is in the last column.

 

distinct Count column 1 and column 2 

 

   Result
    
# CodeColumn 1column 2Total Count
1111FS1
2222FS1
3333F 1
4444FS1
5555V  
6666F 1
  S1
    
Total Count   6

 

Thanks

6 REPLIES 6
CJ_96601
Helper V
Helper V

|| 'Table'[column 2]   - it says token "," expected  

@CJ_96601 ,
Create a calculated column with below DAX:

Total Count =
IF(
    'Table'[Column 1] = "F" || 'Table'[column 2] <> BLANK(),
    1,
    BLANK()
)

 

Here's the result:

Anand24_1-1699283733174.png

In case this doesn't work, please share a screenshot of error.

PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

Anonymous
Not applicable

Hi @CJ_96601 ,

 

According to your statement, I suggest you to try code as below to create the measure.

Result = 
IF('Table'[Column 1] = "F" || 'Table'[column 2] <> BLANK(),1)

Result is as below.

vrzhoumsft_0-1698376888852.png

 

Best Regards,
Rico Zhou

 

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

 

It gives an error...

 

Issue not solve

 

@CJ_96601 ,
What error do you receive?

Anand24
Super User
Super User

Hi @CJ_96601 ,
Create a new calculated column with below DAX:

Total Count =
IF(
    'Table'[Column 1] <> BLANK() || 'Table'[Column 1] <> BLANK(),
    1,
    BLANK()
)

 

Here's the result:

Anand24_0-1698272750292.png
PBI_SuperUser_Rank@1x.png  

Give a Thumbs Up if this post helped you in any way and Mark This Post as Solution if it solved your query !!!

Proud To Be a Super User !!!
LinkedIn

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.