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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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

2 REPLIES 2
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.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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