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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Syndicate_Admin
Administrator
Administrator

Create a New Measure Based on Filter Conditions

I don't know how I do it

1 ACCEPTED SOLUTION
v-linyulu-msft
Community Support
Community Support

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“.

vlinyulumsft_0-1713516284535.png

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:

vlinyulumsft_1-1713516385843.png

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

vlinyulumsft_2-1713516402110.png

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.

View solution in original post

1 REPLY 1
v-linyulu-msft
Community Support
Community Support

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“.

vlinyulumsft_0-1713516284535.png

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:

vlinyulumsft_1-1713516385843.png

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

vlinyulumsft_2-1713516402110.png

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.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors