The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello Community
I have checked some posting and I am not sure how to go about this.
I have 2 tables
Table1 has some items, amounts and a saledate
Table2 has the date ranges and the week number
Table 1
Item | SaleDate(ddmmyyy) | Amount |
abc | 01012020 | 83 |
def | 18012020 | 73 |
ghi | 19022020 | 11 |
jkl | 18012020 | 27 |
Table 2 (date table)
StartDate (ddmmyyy) | EndDate (ddmmyyy) | PeroidName |
01012020 | 07012020 | W1 |
08012020 | 15012020 | W1 |
16012020 | 23012020 | W2 |
What I need is to return the PeroidName that falls inbetween the date rate. Without calculating the sum on that day.
Thank you kindly
I assume you are looking for a calculated column. You can try this expression:
PeriodName = var datethisrow = Table1[SaleDate]
return Calculate(min(Table2[PeriodName), Filter(All(Table2), Table2[StartDate] <= datethisrow && Table2[EndDate]>= datethisrow))
If this solution works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
User | Count |
---|---|
13 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
24 | |
14 | |
13 | |
8 | |
8 |