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
Anonymous
Not applicable

Excel DAX to Power BI

Hello and Happy Friday!

 

I am trying to recreate a Excel report in Power BI and I am almost there but I am having trouble with 2 calculations and how to convert the syntax that is in Excel over to Power BI DAX.

 

The Excel report uses a COUNTIF vs something like - 

 

TMTM1 =
CALCULATE (
COUNTA( 'All Data'[TechNameCompare1] ),ALLEXCEPT('All Data', 'All Data'[TechMatch])
)

 

2019-05-31_7-56-08.png2019-05-31_7-56-23.png

 

Suggestions?

 

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

You may try to use FIND function to get the two columns.For example:

Column =
CALCULATE (
    COUNTROWS ( 'Sample' ),
    FILTER (
        ALLEXCEPT ( 'Sample', 'Sample'[TechName] ),
        FIND ( "Exists in both GoCanvas and e-automate", 'Sample'[TechMatch], 1, 0 ) > 0
            && FIND ( "MAC", 'Sample'[MAC?], 1, 0 ) > 0
            && FIND ( "Exist", 'Sample'[MAC?], 1, 0 ) > 0
    )
)
Column 2 =
CALCULATE (
    COUNTROWS ( 'Sample' ),
    FILTER (
        ALLEXCEPT ( 'Sample', 'Sample'[TechName] ),
        FIND ( "Exists in both GoCanvas and e-automate", 'Sample'[TechMatch], 1, 0 ) > 0
            || FIND ( "e-automate Only,not in GoCanvas", 'Sample'[TechMatch], 1, 0 ) > 0
    )
)

1.png

Regards,

Community Support Team _ Cherie Chen
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

3 REPLIES 3
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

You may try to use FIND function to get the two columns.For example:

Column =
CALCULATE (
    COUNTROWS ( 'Sample' ),
    FILTER (
        ALLEXCEPT ( 'Sample', 'Sample'[TechName] ),
        FIND ( "Exists in both GoCanvas and e-automate", 'Sample'[TechMatch], 1, 0 ) > 0
            && FIND ( "MAC", 'Sample'[MAC?], 1, 0 ) > 0
            && FIND ( "Exist", 'Sample'[MAC?], 1, 0 ) > 0
    )
)
Column 2 =
CALCULATE (
    COUNTROWS ( 'Sample' ),
    FILTER (
        ALLEXCEPT ( 'Sample', 'Sample'[TechName] ),
        FIND ( "Exists in both GoCanvas and e-automate", 'Sample'[TechMatch], 1, 0 ) > 0
            || FIND ( "e-automate Only,not in GoCanvas", 'Sample'[TechMatch], 1, 0 ) > 0
    )
)

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Here is what I ended up with that seems to get me what I needed.

Thank you so much!

 

TMTM1 = IF(CALCULATE ( COUNTROWS ( 'All Data' ),
        FILTER ( ALLEXCEPT ( 'All Data', 'All Data'[TechName] ),
            FIND ( "Exists in both GoCanvas and e-automate", 'All Data'[TechMatch], 1, 0 ) > 0 ||
            FIND ( "MAC Exists", 'All Data'[MacMatch], 1, 0 ) > 0 ) ) > 0,
                CALCULATE ( COUNTROWS ( 'All Data' ),
                    FILTER ( ALLEXCEPT ( 'All Data', 'All Data'[TechName] ),
                        FIND ( "Exists in both GoCanvas and e-automate", 'All Data'[TechMatch], 1, 0 ) > 0 ||
                        FIND ( "MAC Exists", 'All Data'[MacMatch], 1, 0 ) > 0 ) ), 0)
  
TMTM4 = IF(CALCULATE ( COUNTROWS ( 'All Data' ),
    FILTER ( ALLEXCEPT ( 'All Data', 'All Data'[TechName] ),
        FIND ( "Exists in both GoCanvas and e-automate", 'All Data'[TechMatch], 1, 0 ) > 0 ||
FIND ( "e-automate Only, not in GoCanvas", 'All Data'[TechMatch], 1, 0 ) > 0 ) ) > 0 ,
            CALCULATE ( COUNTROWS ( 'All Data' ),
                FILTER ( ALLEXCEPT ( 'All Data', 'All Data'[TechName] ),
                    FIND ( "Exists in both GoCanvas and e-automate", 'All Data'[TechMatch], 1, 0 ) > 0 ||
                    FIND ( "e-automate Only, not in GoCanvas", 'All Data'[TechMatch], 1, 0 ) > 0 ) ),0)
Anonymous
Not applicable

AWESOME!!

 

One last question, where would I add an ELSE to return 0 so that the field is populated with a value?

 

Thank you SO MUCH!!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.