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
PowerBITesting
Helper IV
Helper IV

MultiSelect option set D365 Filter with contains query + OR condition

FILTER on multiple tables with contains - Not working 

 

Count= CALCULATE(
COUNT(activity[createdon]),
FILTER(appointments, appointments[Filed1] contains "100") OR
FILTER(CONTAINS(phonecall,phonecall[Filed2],"200")OR
FILTER(CONTAINS(tasks,tasks[Filed3],"200")
)
appointments , phonecall and tasks  all are child of Activity.
and Filed1 ,Filed2 and Filed3 are multioption set D365
 
1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @PowerBITesting ,

 

You could try like this:

Column =
VAR app_id =
    CALCULATE (
        FIRSTNONBLANK ( appointments[ID], 1 ),
        FILTER (
            VALUES ( appointments[Filed1] ),
            SEARCH ( "100", appointments[Filed1],, 999 ) <> 999
        )
    )
VAR pho_id =
    CALCULATE (
        FIRSTNONBLANK ( phonecall[ID], 1 ),
        FILTER (
            VALUES ( phonecall[Filed2] ),
            SEARCH ( "100", phonecall[Filed2],, 999 ) <> 999
        )
    )
VAR task_id =
    CALCULATE (
        FIRSTNONBLANK ( tasks[ID], 1 ),
        FILTER (
            VALUES ( tasks[Filed3] ),
            SEARCH ( "100", tasks[Filed3],, 999 ) <> 999
        )
    )
RETURN
    COUNTROWS (
        FILTER (
            activity,
            activity[app_id] = app_id
                || activity[pho_id] = pho_id
                || activity[task_id] = task_id
        )
    )

v-xuding-msft_0-1597220030730.png

 

 

Best Regards,
Xue Ding
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-xuding-msft
Community Support
Community Support

Hi @PowerBITesting ,

 

You could try like this:

Column =
VAR app_id =
    CALCULATE (
        FIRSTNONBLANK ( appointments[ID], 1 ),
        FILTER (
            VALUES ( appointments[Filed1] ),
            SEARCH ( "100", appointments[Filed1],, 999 ) <> 999
        )
    )
VAR pho_id =
    CALCULATE (
        FIRSTNONBLANK ( phonecall[ID], 1 ),
        FILTER (
            VALUES ( phonecall[Filed2] ),
            SEARCH ( "100", phonecall[Filed2],, 999 ) <> 999
        )
    )
VAR task_id =
    CALCULATE (
        FIRSTNONBLANK ( tasks[ID], 1 ),
        FILTER (
            VALUES ( tasks[Filed3] ),
            SEARCH ( "100", tasks[Filed3],, 999 ) <> 999
        )
    )
RETURN
    COUNTROWS (
        FILTER (
            activity,
            activity[app_id] = app_id
                || activity[pho_id] = pho_id
                || activity[task_id] = task_id
        )
    )

v-xuding-msft_0-1597220030730.png

 

 

Best Regards,
Xue Ding
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

@PowerBITesting , Try like

 

Count= CALCULATE(
COUNT(activity[createdon]),
OR(OR(appointments[Filed1] contains "100") , CONTAINS(phonecall[Filed2],"200") , CONTAINS(tasks[Filed3],"200"))
)

lbendlin
Super User
Super User

DAX uses || for the "or" logic and && for the "and" logic.

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.