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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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")

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.