Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin 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.
Hi all,
I've found similar topics, but it's hard to applicate this on my case;
I have two tables:
Table Contracts
Supplier | Contract version | Contract start date | Contract end date |
A | 1 | 1-1-2022 | 31-1-2022 |
A | 2 | 1-3-2022 | 1-4-2022 |
B | 1 | 1-1-2022 | 31-12-2022 |
Table Invoices
Supplier | Invoice date | Calculated column; contracted supplier? |
A | 10-1-2022 | Yes |
A | 10-2-2022 | No |
B | etc | etc |
The calculated column; contracted supplier is the goal.
An invoice should be registered under contract, if the invoice date falls between the begin& start date of any contract of that supplier. so in above example; In the first row of the invoice table, the invoice date is 10-1-2022. 10-1-2022 is for supplier A, a date between a contract start and enddate. 10-2-2022 isn't.
With my little dax knowledge i know that i have to search the invoice date in the contractstable, whilst keeping the filter on the supplier of that invoice. But my head can't translate this into dax yet. Any ideas?
Solved! Go to Solution.
Hi,
Calculated Column in Invoices table:
Contracted Supplier =
VAR InvoiceDate = Invoices[Invoice date]
VAR Supplier = Invoices[Supplier]
RETURN
IF(
COUNTROWS(
FILTER(
Contracts,
Contracts[Supplier] = Supplier
&& Contracts[Contract start date] <= InvoiceDate
&& Contracts[Contract end date] >= InvoiceDate
)
),
"Yes",
"No"
)
Regards
Thank you! this works and i can follow the calculations!
Hi,
Calculated Column in Invoices table:
Contracted Supplier =
VAR InvoiceDate = Invoices[Invoice date]
VAR Supplier = Invoices[Supplier]
RETURN
IF(
COUNTROWS(
FILTER(
Contracts,
Contracts[Supplier] = Supplier
&& Contracts[Contract start date] <= InvoiceDate
&& Contracts[Contract end date] >= InvoiceDate
)
),
"Yes",
"No"
)
Regards
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
15 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
22 | |
11 | |
10 | |
10 | |
8 |