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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Help with DAX

Hello Experts - in continuation on the below solution, there is a slightly different requirement, looking forward for your suggestions, as this is kind of urgent.

 

Solved: Re: Compare two excel sheet and calculate how many... - Microsoft Power BI Community

 

the solution worked fine, now got slightly different requirement. There can be Apps with '_Test', but this wont be available in excel 2. In this case we have to compare A1_Test with A1 and show as 100%. 

I tried to add a new column, trimmed '_Test' part and tried to check with entries in Excel 2. But it is not working as expected, it is considering A1_Test and A1 as A1. Need to display A1 and A1_Test as seperate entries in output. Any suggestions will be highly appreciated.

Thanks.

 

Excel 1  Excel 2  
AppColumns  AppColumns
A1C1  A1C1
A1C2  A1C2
A1C3  A1C3
A2C4  A2C4
A2C5  A2C6
A1_TestC1    
A1_TestC2    
A1_TestC3    

 

Expected Output

App% of Columns Aligned?
A1100
A250
A1_Test100
1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

I'd like to suggest you extract the value list based on the current category and use INTERSECT to get intersection items. Then you can use these variables to calculate the percent.

measure =
VAR currCategory =
    SELECTEDVALUE ( Table1[App] )
VAR _list1 =
    CALCULATETABLE (
        VALUES ( Table1[Column] ),
        FILTER ( ALLSELECTED ( Table1 ), [App] = currCategory )
    )
VAR _list2 =
    CALCULATETABLE (
        VALUES ( Table2[Column] ),
        FILTER ( ALLSELECTED ( Table2 ), [App] = currCategory )
    )
VAR _intersect =
    INTERSECT ( _list1, _list2 )
RETURN
    IF (
        _list1 <> BLANK ()
            && _list2 <> BLANK (),
        DIVIDE ( COUNTROWS ( _intersect ), COUNTROWS ( _list1 ), -1 )
    )

Regards,

Xiaoxin Sheng

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Hello everyone I have to do a categorization but this categorization depends on the value of a column

Color =
WHERE i = 'DAX measurement'[Days without weeding]
RETURN
SWITCH(TRUE(),
ISBLANK(i),"white",
i<11, "#68896B",
i<15, "#D2D70E",
"#E0052D")
I have this measurement, it works correctly, but I need that when I filter a place it shows me that, and if I filter another place it returns the same measure but with other parameters
Anonymous
Not applicable

HI @Anonymous,

I'd like to suggest you extract the value list based on the current category and use INTERSECT to get intersection items. Then you can use these variables to calculate the percent.

measure =
VAR currCategory =
    SELECTEDVALUE ( Table1[App] )
VAR _list1 =
    CALCULATETABLE (
        VALUES ( Table1[Column] ),
        FILTER ( ALLSELECTED ( Table1 ), [App] = currCategory )
    )
VAR _list2 =
    CALCULATETABLE (
        VALUES ( Table2[Column] ),
        FILTER ( ALLSELECTED ( Table2 ), [App] = currCategory )
    )
VAR _intersect =
    INTERSECT ( _list1, _list2 )
RETURN
    IF (
        _list1 <> BLANK ()
            && _list2 <> BLANK (),
        DIVIDE ( COUNTROWS ( _intersect ), COUNTROWS ( _list1 ), -1 )
    )

Regards,

Xiaoxin Sheng

lbendlin
Super User
Super User

Why is A1_Test  set to 100% and not 0%?

Anonymous
Not applicable

A1_Test should be considered as an extension of A1. In future there could be entries like A1_Dummy, A1_Sample etc. In all these cases we should ignore the text after A1 and compare with A1 in Excel 2.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors