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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ss89
Helper II
Helper II

Countifs in DAX

Hello Community,

 

I have to replicate from Excel the same formula 2 (highlined in yellow) in Power BI but I get stuck when I try to convert COUNTIFS in Power BI.

 

ss89_1-1680794916271.png

 

Many thanks in advance for your support.

 

All the best,

Silvia

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@ss89 ,

New column =

var _count = count(filter(Table, [Lot_number] =earlier([LOT Number]) && [Formula] = "FALSE"), [LOT_NUMBER])

return

if(isblank(_count), "TRUE", "FALSE")

View solution in original post

v-zhangti
Community Support
Community Support

Hi, @ss89 

 

You can try the following methods.

Column = 
VAR _Count =
    CALCULATE ( COUNT ( 'Table'[LOT_NUMBER] ),
        FILTER ( 'Table',
            [FORMULA] = TRUE
                && [LOT_NUMBER] = EARLIER ( 'Table'[LOT_NUMBER] )
        )
    )
RETURN
    IF ( _Count = 2, TRUE (), FALSE () )

vzhangti_0-1681184327959.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

View solution in original post

4 REPLIES 4
ss89
Helper II
Helper II

Dear @v-zhangti , @amitchandak 

many thanks for your help!

I would like to bring to your kind attention my latest request.

I should filter only LOT_NUMBER that simultaneously satisfy the following characteristics:

STAGE NAMECONDITION
RECEIVINGAPPROVED
SAMPLINGONLINE or APPROVED
QC ID_BETONLINE
QC MICROONLINE
QC MICRO ADDONLINE
QCONLINE
QC BETONLINE
QC ID_CHEMONLINE
QC IRONLINE
QC IDONLINE
QC ID MICROONLINE
NIRONLINE
QC COMPLETEONLINE
QC ID CHEMONLINE
QC ID BETONLINE
QC ID NO MICROONLINE
QC ID SAMPLEONLINE
QC CHEMONLINE
RELEASEONLINE

 

Many thanks in advance for your support!

All the best

If you can give me instructions on how the file with the data can be inserted, I will attach it in the reply. Sorry but I can't find how to attach a file. Thank you very much!

v-zhangti
Community Support
Community Support

Hi, @ss89 

 

You can try the following methods.

Column = 
VAR _Count =
    CALCULATE ( COUNT ( 'Table'[LOT_NUMBER] ),
        FILTER ( 'Table',
            [FORMULA] = TRUE
                && [LOT_NUMBER] = EARLIER ( 'Table'[LOT_NUMBER] )
        )
    )
RETURN
    IF ( _Count = 2, TRUE (), FALSE () )

vzhangti_0-1681184327959.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

amitchandak
Super User
Super User

@ss89 ,

New column =

var _count = count(filter(Table, [Lot_number] =earlier([LOT Number]) && [Formula] = "FALSE"), [LOT_NUMBER])

return

if(isblank(_count), "TRUE", "FALSE")

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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