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.
I have a dataset of employees working on month-to-month basis.
Now, what I need to do is actually add a Slicer on Month Difference, and based upon that, I want to calculate my records.
I have two KPIs,
My second KPI basically tells that how much of the time all the employees were allocated. For example, in the month of November, I had 3 Employees and their total sum of allocation was 2.35.
For now, this is the formula that calculates the total allocation sum,
Total Allocation Utilized = SUM(Competency[Allocation])
As you would have guessed, this works fine if the Filter is set to current month only. But, when I want to do the same for last 2 months, it doesn't work.
What it does is it sums up all the Allocation values. This is ok for one month, but not for multiple months.
Now, I know the logic of what I want to do in programming terms, but unable to replicate the same logic in DAX.
I need to do something like this,
So, if filter is set to "2", then it will take three SUM values of three months (current and last two months) and then at the end, add up those sum values and divide them by 3 (or take their Average Value. I know I have to use AverageX function but I am unable to create those "n" number of SUMs in between)
Can anyone help me out in this? Thank you.
You can download the Power BI File from this link: https://drive.google.com/file/d/10QSUlZiYyISuQj6O-9Zcym2PO4OlUwGq/view?usp=sharing
Solved! Go to Solution.
@HassanAshas Try:
Measure =
VAR __Table =
GROUPBY(
'Competency',
[Month],
"__Allocation",SUMX(CURRENTGROUP(),[Allocation])
)
VAR __Result = AVERAGEX(__Table,[__Allocation])
RETURN
__Result
@HassanAshas Try:
Measure =
VAR __Table =
GROUPBY(
'Competency',
[Month],
"__Allocation",SUMX(CURRENTGROUP(),[Allocation])
)
VAR __Result = AVERAGEX(__Table,[__Allocation])
RETURN
__Result
Oh my God! That worked like a Charm!!
Going to understand how is this working now on a paper. Thank you so much for such a quick and an AMAZING response!
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 |
---|---|
107 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |