Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
2 years ago
Solved

Create a New Measure Based on Filter Conditions

I don't know how I do it

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi, Syndicate_Admin 

    First of all, in my understanding, your problem is that in case the filter changes, measure will change depending on the option attempted, and if my understanding is wrong, I hope you can give me some suggestions to help me better understand your question.

    1. Regarding your question I would suggest you to get to know the Allselected function, the main purpose of the Allselected function is to retain the filtering conditions for filtering in case the filtering conditions are realized.You can refer to my documentation and examples below:

    ALLSELECTED:Removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters.

    ALLSELECTED function (DAX) - DAX | Microsoft Learn

    1. Here's a simple example from me to help understand and use MEASURE:

    First I created one tables, one master table, the master table is named "report“.

    Here are the measure I've constructed about this.

     

     

    Measure = SUMX(ALLSELECTED('report'),[Amount])

     

     

    The function is changed according to the [Amount] column.

    When I add the measure to the filter the result looks like this:

    After I filtered row B from the view filter, it looks like this:

    I hope my case study helps you understand the allselected function.
    3.If you are interested in this area, the following is also very similar to Allselected:

    ALL function (DAX) - DAX | Microsoft Learn

    ALLEXCEPT function (DAX) - DAX | Microsoft Learn

    If my output is not what you expected, can you provide sample data and sample output in tabular format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

    Best Regards,
    Leroy Lu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Syndicate_Admin 

    First of all, in my understanding, your problem is that in case the filter changes, measure will change depending on the option attempted, and if my understanding is wrong, I hope you can give me some suggestions to help me better understand your question.

    1. Regarding your question I would suggest you to get to know the Allselected function, the main purpose of the Allselected function is to retain the filtering conditions for filtering in case the filtering conditions are realized.You can refer to my documentation and examples below:

    ALLSELECTED:Removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters.

    ALLSELECTED function (DAX) - DAX | Microsoft Learn

    1. Here's a simple example from me to help understand and use MEASURE:

    First I created one tables, one master table, the master table is named "report“.

    Here are the measure I've constructed about this.

     

     

    Measure = SUMX(ALLSELECTED('report'),[Amount])

     

     

    The function is changed according to the [Amount] column.

    When I add the measure to the filter the result looks like this:

    After I filtered row B from the view filter, it looks like this:

    I hope my case study helps you understand the allselected function.
    3.If you are interested in this area, the following is also very similar to Allselected:

    ALL function (DAX) - DAX | Microsoft Learn

    ALLEXCEPT function (DAX) - DAX | Microsoft Learn

    If my output is not what you expected, can you provide sample data and sample output in tabular format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

    Best Regards,
    Leroy Lu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.