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
spaceuser
New Member

Need help to convert an Excel formula into PowerBI

Just started with PowerBI. Need to following Excel formula to measure different short codes in PowerBI. 

 

=COUNTIF(A2;"*AI*")

=COUNTIF(A2;"*AR*")

 

EXCEPTION_NAME    AI   AR

AI,LS,MP,UPL,AR        1      1

AI,LS,MP                    1      0

CW,AR                       0      1

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @spaceuser

 

You may refer to below measure.

AI = 
CALCULATE (
    COUNT ( Table1[EXCEPTION_NAME] ),
    FILTER ( Table1, SEARCH ( "AI", Table1[EXCEPTION_NAME], 1, 0 ) > 0 )
)
    + 0
AR = CALCULATE(COUNT(Table1[EXCEPTION_NAME]),FILTER(Table1,SEARCH("AR",Table1[EXCEPTION_NAME],1,0)>0))+0

1.png

Regards,

Cherie

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

2 REPLIES 2
v-cherch-msft
Employee
Employee

Hi @spaceuser

 

You may refer to below measure.

AI = 
CALCULATE (
    COUNT ( Table1[EXCEPTION_NAME] ),
    FILTER ( Table1, SEARCH ( "AI", Table1[EXCEPTION_NAME], 1, 0 ) > 0 )
)
    + 0
AR = CALCULATE(COUNT(Table1[EXCEPTION_NAME]),FILTER(Table1,SEARCH("AR",Table1[EXCEPTION_NAME],1,0)>0))+0

1.png

Regards,

Cherie

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.
Greg_Deckler
Super User
Super User

Several ways to do this, one way:

 

 

Measure AI = COUNTX(FILTER('Table',[AI]=1),[EXCEPTION_NAME])

Measure AR = COUNTX(FILTER('Table',[AR]=1),[EXCEPTION_NAME])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.