Forum Discussion
Elephant Data: Want to filter THEN transform the data and run calculations in report view
Hi KStout ,
Thank you for reaching out to Microsoft Community.
Calculate the total count of all behaviors observed for a specific date and individual, respecting slicers and filters.
DailyTotal = CALCULATE(
SUM('Raw Data'[BCount]),
ALLEXCEPT('Raw Data', 'Raw Data'[Date], 'Raw Data'[Focal Name]))
Calculate the count of behaviors observed for each behavior and individual, again respecting slicers.
BehaviorCount = CALCULATE(
SUM('Raw Data'[BCount]),
ALLEXCEPT('Raw Data', 'Raw Data'[Date], 'Raw Data'[Focal Name], 'Raw Data'[Behavior]))
Calculate the Daily Behavior Percentage which is the key measure, it calculates the percentage of each behavior observed for each individual and day.
DailyPct = VAR DailyTotalValue = [DailyTotal]
VAR BehaviorCountValue = [BehaviorCount]
RETURN
IF(
DailyTotalValue = 0,
BLANK(),
DIVIDE(BehaviorCountValue, DailyTotalValue, 0))
Now calculate the mean daily percentage for all behaviors across different time slices example by hour:
AverageDailyPct = AVERAGEX(
VALUES('Raw Data'[Date]),
[DailyPct])
Hope this will help.
Thank you.
Hi, thank you, this is so close! Unfortunely, my numbers are a tad off from what they need to be. I doubled checked and ran the calculations in Excel and the Power Query Activity budget I created was correct. The one made with measures was just slightly off. Do you have any ideas why?
- PhilipTreacy11 months ago
Super User
Not without seeing the data you are using. Please provide it, preferably your PBIX file.
Phil