I’m trying to create a measure which calculates (Average) days on site for many different locations. I’m able to get the days on each site based on the measure below.
Days on Site =
CALCULATE (
COUNTROWS ( DISTINCT ( ‘Lem Entry’[Date])
))
My PBI table looks looks like the attached.
data.csv (190 Bytes)
How would I create a measure that would show the average of those ‘days on site’ if I created one card?
Give this measure a go and see how it works. Without a PBIX file I’m guessing in some cases what your data model looks like and your fields are named. Generally, you will get the best response/solution on the forum if you provide your Power BI file and a mockup of the results you’re looking for. But see how this works, and if you have problems with it, give a shout and we can work through more specific solution with your actual data.
Avg Days on Site =
VAR vTable =
ADDCOLUMNS (
SUMMARIZE ( 'Lem Entry', 'Lem Entry'[Site] ),
"@DaysOnSite", [Days on Site]
)
RETURN
AVERAGEX ( vTable, [@DaysOnSite] )
This seems to be working Brian! Wow, thanks- I’d love to share the file, however a bit concerned to share the companies’ financials. How do we get around that?
Great – glad to hear that worked well for you. If you haven’t already, be sure to subscribe to the Enterprise DNA YouTube channel – lots of great content, and I’ve got a video coming out early next week that addresses this specific issue (getting measures in cards to calculate correctly) in detail.
In terms of the confidential/sensitive data problem, that’s really common issue. To help people on the forum provide their data without compromising sensitivity, I put together the following video on masking information. Good thing to keep in your back pocket for the next problem requiring forum support:
Always great to have new folks here. It’s a really wonderful community, and I think you’ll enjoy it and learn a lot. I learn new stuff every day here…