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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

Create a New Measure Based on Filter Conditions

I don't know how I do it

1 ACCEPTED SOLUTION
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“.

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

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.