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

Need to convert M query as Dax fuction code

@Jihwan_Kim@johnt75@amitchandak


Hi all,

 

Could you anybody please convert this below M query to Dax function 

Venkatesan_0-1648195276603.png

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please try this.

Result_OPS = 
SWITCH(
    TRUE(),
    CONTAINS('Table','Table'[PP],'Table'[Ops],'Table'[Image  Name],'Table'[Image  Name]),"Match",
    'Table'[Ops]=BLANK(),BLANK(),
    "Not Match"
)
Result_PP = 
SWITCH(
    TRUE(),
    CONTAINS('Table','Table'[Ops],'Table'[PP],'Table'[Image  Name],'Table'[Image  Name]),"Match",
    'Table'[PP]=BLANK(),BLANK(),
    "Not Match"
)

 

vcgaomsft_0-1648603484747.png

 

Attach the PBIX file for reference. Hope it helps.

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Anonymous
Not applicable

Venkatesan_0-1648196988031.png

this is the expected output as per my requirement
There should two result "Result_OPS" and "Result_PP" 
It should compare ops value against pp value per set of image and vise versa you can find it in screen shot
I had already shared the Power query code which i can able to get the output but its not making the performance down so why i m going to dax 
PLease help to conver the Power query to Dax function 
If you need any furthur details please let me know  

Hi @Anonymous ,

 

Please create two calculated columns.

Result_OPS = 
SWITCH(
    TRUE(),
    CONTAINS('Table','Table'[PP],'Table'[Ops],'Table'[Image  Name],'Table'[Image  Name]),"Match",
    "Not Match"
)
Result_PP = 
SWITCH(
    TRUE(),
    CONTAINS('Table','Table'[Ops],'Table'[PP],'Table'[Image  Name],'Table'[Image  Name]),"Match",
    "Not Match"
)

The result is shown in the figure.

vcgaomsft_0-1648543789999.png

Attach the PBIX file for reference. Hope it helps.

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Anonymous
Not applicable

Hi ,

Thanks for your response for my post actually I need my output as shown in the below screen shot 

Venkatesan_0-1648564648416.png

actually here if you see , column PP contains 6 row of data and OPS contains 3 row of data .Our result should be of this row wise data 

For Example 

If PP columns matches with OPS columns then result should be "Match" else "Not Match"
and should have 6 result as a output,  because it contain only  6 row of data 

If OPS columns matches with PP columns then result should be "Match" else "Not Match"
and should have only 3 result as a output , because it contain only 3 row of data 

Remaining should be of "Blank" value



Hi @Anonymous ,

 

Please try this.

Result_OPS = 
SWITCH(
    TRUE(),
    CONTAINS('Table','Table'[PP],'Table'[Ops],'Table'[Image  Name],'Table'[Image  Name]),"Match",
    'Table'[Ops]=BLANK(),BLANK(),
    "Not Match"
)
Result_PP = 
SWITCH(
    TRUE(),
    CONTAINS('Table','Table'[Ops],'Table'[PP],'Table'[Image  Name],'Table'[Image  Name]),"Match",
    'Table'[PP]=BLANK(),BLANK(),
    "Not Match"
)

 

vcgaomsft_0-1648603484747.png

 

Attach the PBIX file for reference. Hope it helps.

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

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.