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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
john_elmasry
Frequent Visitor

All Selected is not working properly, I have to include another Column

Hello,

I have a fact table that has multiple colums:

Item,Period_Name,Period_ID,Sales

Period name is like Jan 2022 , Feb 2022 etc

Period_ID is like 202201 , 202202 etc

 

I created one slicer in the dashboard that has "Period_Name" Field and created 1 grid in the dashboard in which I want to include 4 columns:  Item, Period, Sales Value, Sales value (for the all selected periods) , Sales Value (for all the periods selected and unselected)

 

I created the measures like this

Total Value Sales = CALCULATE(SUM(Fact_Sales[Value Sales]))
Total Value Sales (Selected Period) = CALCULATE([Total Value Sales], ALLSELECTED(Fact_Sales[Period]))
Total Value Sales (Ignore Period) = CALCULATE([Total Value Sales], ALL(Fact_Sales[Period]))
 
But I got wrong results like the image
john_elmasry_0-1680263610014.png

 

I tried so much to solve it and solved successfully by changing in the measures

 

Total Value Sales (Selected Period) = CALCULATE([Total Value Sales], ALLSELECTED(Fact_Sales[Period]),ALLSELECTED(Fact_Sales[PERIOD_ID]))
Total Value Sales (Ignore Period) = CALCULATE([Total Value Sales], ALL(Fact_Sales[Period]),ALL(Fact_Sales[PERIOD_ID]))
john_elmasry_1-1680263691156.png
As you can see, numbers now are reflecting correctly... but I am unable to understand the behaviour, why it didn't work although I am not using this Period_ID column anywhere? 
 
also I wanted to create another sheet with dummy data to upload here to the community to make things easier, but surprisingly it worked successfully without adding the second condition.
 
Does anyone have a clue?
 
Thanks.
John Elmasry
 
1 ACCEPTED SOLUTION
john_elmasry
Frequent Visitor

I found the solution to whom it may concern.

The reason is because the Period Column was sorted by Period ID Column, in this situation you have to include both columns in ALL and ALLSELECTED.

Refer to this video

https://youtu.be/rvpKSH3zRcg?t=465

 

View solution in original post

3 REPLIES 3
john_elmasry
Frequent Visitor

I found the solution to whom it may concern.

The reason is because the Period Column was sorted by Period ID Column, in this situation you have to include both columns in ALL and ALLSELECTED.

Refer to this video

https://youtu.be/rvpKSH3zRcg?t=465

 

Wow, thank you for this. Never would have found this out if not for this post. I had the same problem.

Same. I struggled with this for HOURS and this post helped me fix it. Thank you! 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.