Forum Discussion
Data grouping based on second table
- Anonymous2 years ago
Hi Mike1309
I have understood about your problem, here is the solution I offer:
Here are the data of the two tables, you can check the date type, here it is recommended to use the (m/d/yyyy) format
Create a measure, you can match the period by judging the country name and date range.
result = var invoiceDate = SELECTEDVALUE(invoices[invoice date]) var invoiceCountry = SELECTEDVALUE(invoices[country]) RETURN CALCULATE( MAX(periods[period]), FILTER(periods, periods[country] = invoiceCountry && periods[start day] <= invoiceDate && periods[end day] >= invoiceDate))Here is the result, and you can add slicers to filter
Best Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Mike1309
I have understood about your problem, here is the solution I offer:
Here are the data of the two tables, you can check the date type, here it is recommended to use the (m/d/yyyy) format
Create a measure, you can match the period by judging the country name and date range.
result = var invoiceDate = SELECTEDVALUE(invoices[invoice date])
var invoiceCountry = SELECTEDVALUE(invoices[country])
RETURN CALCULATE(
MAX(periods[period]),
FILTER(periods,
periods[country] = invoiceCountry &&
periods[start day] <= invoiceDate &&
periods[end day] >= invoiceDate))
Here is the result, and you can add slicers to filter
Best Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.