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
maryjanesmith
Helper I
Helper I

Count if two columns are equal and a third not

Hi everyone!

My goal is to count the tickets that reopen for the same reason. But I have duplicates because of the granularity of the table so I cannot count these records.  In order to do that I only want to count records that are the same for idticket and idclient but have a different open date.


In this example (table above) the count should be 2:
idticket 12, idclient 1,18/07
idticket 12, idclient 6, 5/12

idticket idclient Date

1200112/07/2021
1200112/07/2021
1200112/07/2021
1200118/07/2021
1200604/12/2021
1200605/12/2021
12100 
13007 
1302014/07/2021
1400713/07/2021
1401301/07/2021
1401301/07/2021
17006 
22050 


Pbix file: https://1drv.ms/u/s!AuMLcKZkL7PFgkKbiP_ddk_0CnNR?e=4mt9JI

Thank you in advance 🙂

 

8 REPLIES 8
maryjanesmith
Helper I
Helper I

Hi
Thank you for your answer! but in my report (not the example file) when I try to do the same I have this error. This happens inside the earlier function:

 

maryjanesmith_2-1645008101441.jpeg

 

 

@maryjanesmith You are creating a column not a measure right?

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Yes, I created a column, not a measure.

@maryjanesmith can you share the snapshot of your code and can you please check the attached file for reference.

 

https://we.tl/t-uEGmsxJNik 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Sorry my mistake, I put the column in the wrong table. But there is one problem, for example, In this case below, the count should be 4 and not 5. The line with date 13/07 is repeated and should only be counted once 😕  I updated the file with this example and the table 2 with more examples. @Samarth_18 can you help?
 https://1drv.ms/u/s!AuMLcKZkL7PFgkKbiP_ddk_0CnNR?e=cwfOF5

idticketidclientDate_timeColumn

1200112/07/20210
1200112/07/20210
1200112/07/20210
1200113/07/20211
1200113/07/20211
1200114/07/20211
1200118/07/20211
1200119/08/20211

This is my code of the calculated column: I just replaced your code with my real tables and columns:

maryjanesmith_0-1645011025083.png

 

 

@maryjanesmith something is really missing. Is it possible for you to share PBIX file after removing sensitive data?

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Samarth_18
Community Champion
Community Champion

Hi @maryjanesmith ,

 

You can create a column with below code and use it as filter on your visual:-

Column =
VAR result =
    COUNTROWS (
        FILTER (
            ALL ( 'Table' ),
            'Table'[idclient] = EARLIER ( 'Table'[idclient] )
                && 'Table'[idticket] = EARLIER ( 'Table'[idticket] )
                && 'Table'[Date_time] < EARLIER ( 'Table'[Date_time] )
        )
    )
RETURN
    IF ( result <> 0, 1, 0 )

 

Output:-

Samarth_18_0-1645006556727.png

 

Updated file below:-

https://we.tl/t-uEGmsxJNik 

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on 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.