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
Anonymous
Not applicable

Differences in behavior of ALL, ALLEXCEPT, ALLSELECTED functions when using ADDCULMNS in measure

Hi, I made a measure of 3 functions assuming the figure below.

However, ALL SELECTED and ALL behaved differently.

Even though I removed the filter in the "day" column, it behaves as if the filter remains.

I want to know why this happens and the solution. (What I want to make is "Measure_ALL SELECTED".)

thank you.

f_999_1-1642559059556.png

f_999_2-1642559097726.png

Measure_ALL =
var table1 = ADDCOLUMNS('table',"measure1",CALCULATE(COUNTROWS('table'),ALL('table'[day])))
RETURN
MAXX(table1,[measure1])
 
Measure_ALLEXCEPT =
var table1 = ADDCOLUMNS('table',"measure1",CALCULATE(COUNTROWS('table'),ALLEXCEPT('table','table'[value])))
RETURN
 
measure_ALLSELECTED =
var table1 = ADDCOLUMNS('table',"measure1",CALCULATE(COUNTROWS('table'),ALLSELECTED('table'[day])))
RETURN
MAXX(table1,[measure1])
MAXX(table1,[measure1])
1 ACCEPTED SOLUTION

Hi @Anonymous ,

You can try to create a calculated table with the formula of the variable table1 and then see the final table obtained. From the figure below, you can see that the values of measure1 end up with a value of 1. In this case, you apply the date slicer only with the number of records affected. Without applying the date slicer filter, both all() and allselected() will return data like the table below.

yingyinr_1-1642752783312.png

If you apply a date filter (day>=2022/1/3) and use allselected, the variable table1 will only display the following 8 rows, and the value of measure1 will still be 1...

yingyinr_2-1642752935920.png

You can review the content in the following links to get more details about ALL(), ALLSELECTED and ALLEXCEPT().

ALLSELECTED()

ALL vs ALLSELECTED in DAX and Power BI Desktop

ALL Vs ALLSELECTED Vs ALLEXCEPT DAX FIiter Functions

The (ALL, ALLSELECTED & ALLEXCEPT) Code

Best Regards

Community Support Team _ Rena
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
Anonymous
Not applicable

I'm sorry.The position of MAXX was wrong. 

Measure_ALL = 
var table1 = ADDCOLUMNS('table',"measure1",CALCULATE(COUNTROWS('table'),ALL('table'[day])))
RETURN
MAXX(table1,[measure1])
Measure_ALLEXCEPT = 
var table1 = ADDCOLUMNS('table',"measure1",CALCULATE(COUNTROWS('table'),ALLEXCEPT('table','table'[value])))
RETURN
MAXX(table1,[measure1])
measure_ALLSELECTED = 
var table1 = ADDCOLUMNS('table',"measure1",CALCULATE(COUNTROWS('table'),ALLSELECTED('table'[day])))
RETURN
MAXX(table1,[measure1])

thank you

Hi @Anonymous ,

You can try to create a calculated table with the formula of the variable table1 and then see the final table obtained. From the figure below, you can see that the values of measure1 end up with a value of 1. In this case, you apply the date slicer only with the number of records affected. Without applying the date slicer filter, both all() and allselected() will return data like the table below.

yingyinr_1-1642752783312.png

If you apply a date filter (day>=2022/1/3) and use allselected, the variable table1 will only display the following 8 rows, and the value of measure1 will still be 1...

yingyinr_2-1642752935920.png

You can review the content in the following links to get more details about ALL(), ALLSELECTED and ALLEXCEPT().

ALLSELECTED()

ALL vs ALLSELECTED in DAX and Power BI Desktop

ALL Vs ALLSELECTED Vs ALLEXCEPT DAX FIiter Functions

The (ALL, ALLSELECTED & ALLEXCEPT) Code

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

thank you for your reply
It's easy to check if you use a table.
I will also read the reference.
Thank you!

 

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.