Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi,
I have a measure called Datediff that calculates the date difference from a list a Purchase dates to the end of each month in the year.
The result looks like this:
For example on 20th of April I purchased 2 items, each having a 10 days difference to the end of April.
What I would like is the total on the April column to show 89 (which is 24+22+11+10+10+9+2+1+0+0).
Then I can calculate the average for the 10 items by dividing the 2 measure Datediff/TotalItems.
The idea is to have the average date difference of all items to the end of each month.
My Datediff measure looks like this:
Datediff =
VAR _Days = CALCULATE(
SWITCH(
FALSE(),
SELECTEDVALUE(Item[PurchasedDate]) <= SELECTEDVALUE('Date'[Date]),
DATEDIFF(SELECTEDVALUE(Item[PurchasedDate]),EOMONTH(MAX('Date'[Date]),0), DAY),
0
), ALL('Date'[Date]), 'Date'[Date]<=MAX('Date'[Date]), Item[Status] = "Stock"
)
VAR _Items = CALCULATE(
COUNT(Items[ItemID]), Item[Status] = "Stock",
ALL('Date'[Date]),
'Date'[Date] <= MAX('Date'[Date]),
USERELATIONSHIP('Date'[Date],Item[PurchasedDate])
)
RETURN
_Days*_Items
Solved! Go to Solution.
Please see this video for how to get your expected totals.
(2) Power BI - Tales from the front #01 - Getting the Right Total - YouTube
Pat
Please see this video for how to get your expected totals.
(2) Power BI - Tales from the front #01 - Getting the Right Total - YouTube
Pat
Thank you! It helped.
User | Count |
---|---|
11 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
25 | |
19 | |
16 | |
10 | |
7 |