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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Compare one value from a measure to all the rest using ALLEXCEPT

Hello Power BI community!

 

This might be a repeating post but I can't make this to work. I have a simple data of restaurants reservations. I have a task to compare one restaurant vs. all others on a monthly basis. So, basically I need to count the reservations per selected restaurant on a slicer and then subtract it from all reservations. But I allso need to take into consideration filter context of a date hierarchy in my eigher chart or a matrix. So I need to use ALLEXCEPT to retain the date filter. 

 

Below is my DAX:

 

ComparedResult =
VAR SelectedVenue = SELECTEDVALUE(Resy[Venue_Name__c])
VAR AllOtherReservations = CALCULATE
(
COUNT(Resy[Name]),
ALLEXCEPT(Resy, Resy[Reservation Date].[Date]),
Resy[Venue_Name__c] <> SelectedVenue
)
RETURN
AllOtherReservations
 
Here is what I have on a matrix. CompareResult is the DAX above. ReservationCount is another measure that is sliced by a restaurant. So it works but the DAX above doesn't. Any help will be appreciated.
 

ResyDAXResult.png

 

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Based on your measure and table screen, the matrix visual is based on year and month but the measure allexcept() uses date, maybe change it like this:

ComparedResult = 
VAR SelectedVenue =
    SELECTEDVALUE ( 'Resy'[Venue_Name_c] )
VAR AllOtherReservations =
    CALCULATE (
        COUNT ( Resy[Venue_Name_c] ),
        ALLEXCEPT ( Resy, Resy[Reservation Date].[Month] ),
        Resy[Venue_Name_c] <> SelectedVenue
    )
RETURN
IF( AllOtherReservations <> BLANK(), AllOtherReservations, 0 )

table.pngmatrix.png

 

Best Regards,
Yingjie Li

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

6 REPLIES 6
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Based on your measure and table screen, the matrix visual is based on year and month but the measure allexcept() uses date, maybe change it like this:

ComparedResult = 
VAR SelectedVenue =
    SELECTEDVALUE ( 'Resy'[Venue_Name_c] )
VAR AllOtherReservations =
    CALCULATE (
        COUNT ( Resy[Venue_Name_c] ),
        ALLEXCEPT ( Resy, Resy[Reservation Date].[Month] ),
        Resy[Venue_Name_c] <> SelectedVenue
    )
RETURN
IF( AllOtherReservations <> BLANK(), AllOtherReservations, 0 )

table.pngmatrix.png

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Yingjie Li, thank you, it works for the most part. The only issue is that now I see data for the rest of the year in 2020 and first two months in 2019 where there was no data. It stays constant when I click different restaurants. I checked my data and the latest is from May 2020. I do not understand where these future months came from. Since I have the Year in a hierarchy, and I do this in DAX, can that be a reason?

ALLEXCEPT ( Resy, Resy[Reservation Date].[Month] ),

 

 

Anonymous
Not applicable

Yingjie Li, I am accepting your reply as a solution. I found a way to do both Year and Month by using a Year Month column from a Calerndar table I have that is joined to my Resy table. 

Thank you for your help!

 

Stan

amitchandak
Super User
Super User

@Anonymous ,Can you share sample data and sample output in table format?

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Yes, sure. I replaced the venue name with a letter. 

 

Resy-0000000011q3/16/2019 2:00
Resy-0000000012q3/16/2019 2:00
Resy-0000000013k3/15/2019 16:30
Resy-0000000014k3/15/2019 16:45
Resy-0000000015k3/15/2019 16:45
Resy-0000000016k3/15/2019 16:30
Resy-0000000017k3/15/2019 17:15
Resy-0000000018k3/15/2019 17:30
Resy-0000000019k3/15/2019 19:00
Resy-0000000020w3/15/2019 17:00
Resy-0000000021w3/15/2019 17:45
Resy-0000000022w3/15/2019 17:45
Resy-0000000023w3/15/2019 18:00
Resy-0000000024w3/15/2019 18:15
Resy-0000000025w3/15/2019 22:00
Resy-0000000026w3/15/2019 22:30
Resy-0000000027w3/15/2019 23:45
Resy-0000000028w3/16/2019 0:00
Resy-0000000029w3/16/2019 1:30
Resy-0000000030w3/16/2019 1:45
Resy-0000000031e3/15/2019 16:45
Resy-0000000032e3/15/2019 17:00
Resy-0000000033e3/15/2019 18:30
Resy-0000000034e3/15/2019 22:00
Resy-0000000035e3/15/2019 23:00
Resy-0000000036e3/15/2019 23:30
Resy-0000000037e3/16/2019 0:00
Resy-0000000038e3/16/2019 0:00
Resy-0000000039e3/16/2019 0:15
Resy-0000000040e3/16/2019 0:30
Resy-0000000041e3/16/2019 0:30
Resy-0000000042e3/16/2019 1:00
Resy-0000000043h3/15/2019 21:45
Resy-0000000044h/16/2019  12:00:00 AM

 

 

Anonymous
Not applicable

Sorry, forgot the headers:

NameVenue_Name__c

ReservationDate

 

The last date is starting with 3 for March. 

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.