Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi
I am trying to create a list of distinct dates a customers have entered a store by date but only for a specified set of locations.
I seem to be running into an error when I try to add more than one location.
My data is laid out as follows
CustomerID | CustomerName | PrimaryMembership | AccessRule | EntryDate | Type | Location |
12345 | Bob | Full | 2DAF | 01/01/2022 | Cycle | Norwich |
12345 | Bob | Full | 2DAF | 02/01/2022 | Cycle | Norwich |
12345 | Bob | Full | 2DAF | 03/01/2022 | Cycle | Norwich |
12345 | Bob | Full | 2DAF | 04/01/2022 | Cycle | Norwich |
12345 | Bob | Full | 2DAF | 05/01/2022 | Cycle | Norwich |
23456 | Jo | Full | 2DAF | 01/01/2022 | Car | London |
23456 | Jo | Full | 2DAF | 02/01/2022 | Car | London |
23456 | Jo | Full | 2DAF | 03/01/2022 | Car | London |
23456 | Jo | Full | 2DAF | 04/01/2022 | Car | London |
23456 | Jo | Full | 2DAF | 05/01/2022 | Car | Norwich |
34567 | Jane | Full | 2DAF | 01/01/2022 | Cycle | Clacton |
78910 | Anne | Full | 2DAF | 01/01/2022 | Car | Norwich |
89101 | Terry | Full | 2DAF | 01/01/2022 | Cycle | London |
91011 | Michael | Full | 2DAF | 01/01/2022 | Cycle | Norwich |
10111 | Steve | Full | 2DAF | 01/01/2022 | Cycle | London |
11121 | Alyssa | Full | 2DAF | 01/01/2022 | Car | Clacton |
12131 | Martin | Full | 2DAF | 01/01/2022 | Car | Clacton |
13141 | Robin | Full | 2DAF | 01/01/2022 | Car | Norwich |
15161 | Dave | Full | 2DAF | 10/01/2022 | Car | Cambridge |
Using the following I end up with a resulting table that on the face of it seems correct.
DISTINCT(
SELECTCOLUMNS(
FILTER(
Entry,
Entry[EntryDate] <> BLANK()
--&& Entry[CustomerID] = 15161
&& Entry[Location] ="Norwich" ||
Entry[Location] = "London" ||
Entry[Location] = "Clacton"
),
"_EntryDate",[EntryDate]
)
)
However
If remove the comment from
&& Entry[CustomerID] = 15161
I would expect the result to be an empty table as they don't have an entry in those locations but I seem to be getting the whole list regardless.
If I ammend the code to just have a single location then i get the blank table as expected.
I'm assuming something is going awry with the OR element of this but I can't figure out why.
I'm using the ID as a test, I will comment out and filter by ID in the report but I have 160000 rows of data so need to do a little sense checking.
Help!
Solved! Go to Solution.
Hi @EWBWEBB,
The OR has to be applied only within the condition for checking the location. Everything else will be checked with AND. Brackets will fix your code:
DISTINCT(SELECTCOLUMNS(FILTER(Entry,
(Entry[EntryDate] <> BLANK())
&& (Entry[CustomerID] = 15161)
&& (Entry[Location] = "Norwich"
|| Entry[Location] = "London"
|| Entry[Location] = "Clacton")),"_EntryDate",Entry[EntryDate]))
Works for you? Mark this post as a solution if it does!
Consider taking a look at my blog: Forecast Period - Previous Forecasts
Hi @EWBWEBB,
The OR has to be applied only within the condition for checking the location. Everything else will be checked with AND. Brackets will fix your code:
DISTINCT(SELECTCOLUMNS(FILTER(Entry,
(Entry[EntryDate] <> BLANK())
&& (Entry[CustomerID] = 15161)
&& (Entry[Location] = "Norwich"
|| Entry[Location] = "London"
|| Entry[Location] = "Clacton")),"_EntryDate",Entry[EntryDate]))
Works for you? Mark this post as a solution if it does!
Consider taking a look at my blog: Forecast Period - Previous Forecasts
Spot on, that worked like a charm.
Thank you
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
11 | |
11 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |