Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have two table Calendar and Purchases.
Calendar:
Date | Week of Year |
2020-01-01 | 1 |
2020-01-02 | 1 |
... | ... |
2020-12-31 | 53 |
Purchases:
ID | Title | Start of purchase | End of purchase |
1 | Monitors | 2020-01-10 | 2020-02-16 |
2 | Laptops | 2020-02-01 | 2020-03-05 |
How can I show in the report in which weeks and how much purchases were in progress?
The week in which the purchase was completed shall not be included in that week.
For example, I need to see in report:
Solved! Go to Solution.
Hi @Anonymous ,
According to your description, I created some data to show:
Here are the steps you can follow:
1. Create calculated column.
Start_week = WEEKNUM('Table'[Start of purchase],1)
End_week = WEEKNUM('Table'[End of purchase],1)
2. Create calculated column.
Number of purchases =
var _time=
CALCULATE(COUNT('Table'[Title]),FILTER('Table','Week Of Year'[Week of Year]>='Table'[Start_week]&&'Week Of Year'[Week of Year]<='Table'[End_week]))
return IF(_time=BLANK(),0,_time)
3. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
According to your description, I created some data to show:
Here are the steps you can follow:
1. Create calculated column.
Start_week = WEEKNUM('Table'[Start of purchase],1)
End_week = WEEKNUM('Table'[End of purchase],1)
2. Create calculated column.
Number of purchases =
var _time=
CALCULATE(COUNT('Table'[Title]),FILTER('Table','Week Of Year'[Week of Year]>='Table'[Start_week]&&'Week Of Year'[Week of Year]<='Table'[End_week]))
return IF(_time=BLANK(),0,_time)
3. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@ryan_mayu , hi, thank you.
Everything looks good, but if the purchase doesn’t have an end date, the report doesn’t count it. Such a purchase must be in progress (today he is in progress). Can you update the COUNT formula? Thank you.
@Anonymous
maybe you can try this
COUNT =
CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[start of purchased]<='calendar'[Date]&&('Table'[End of purchased]>='calendar'[Date]&&WEEKNUM('Table'[End of purchased],2)<>'calendar'[week of year]||ISBLANK('Table'[End of purchased]))))
Proud to be a Super User!
@ryan_mayu That formula doesn't work well. The number of ongoing purchases has increased. Past and future purchases are also displayed. It's not good 😕
@amitchandak , I am not a professional, maybe you can detail the formulas according to my example? Because I can't relate your example to my example.
@Anonymous , refer if this attached file can replace
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |