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 all,
I am trying count how many active employees in current month (based in the slicer selection) had bonus in the last 12 months.
Exemple:
If i select FEB/2021, i'd like to get the number of employees active in FEB/2021 which get bonus in the last 12 months (from FEB/2020 until JAN/2021) .
I have a measure to calucalate the active employees per month which is working fine, and i create a measure to calculate the total of bonus paid in the last 12 months:
CALCULATE( SUM(Bonus[Value]),
DATESBETWEEN(_Calendar[DATE],
FIRSTDATE ( PARALLELPERIOD ( _Calendar[DATE], -12, MONTH ) ),
FIRSTDATE ( PARALLELPERIOD ( _Calendar[DATE], -1, MONTH ) ) ) )
The employee table and bonus table are linked by the employee ID.
I tried to calcualte the number of active employee in the last 12 months with this kind of formula:
CALCULATE ( [HC - employee] , [Bonus last 12 months] > 0 )
however is not possible to use measure or calculate as filter. is there anyway i can achive it ?
Solved! Go to Solution.
Hi, @Anonymous
In card visual,you need to generate a temporary table and then filter data in this table, please change your new measure as below:
Measure_2 =
VAR tab =
SUMMARIZE ( bonus, Emploloyees[Name], "Headcount", [HEADCOUNT] )
RETURN
CALCULATE ( [HEADCOUNT], FILTER ( tab, [Bonus paid] > 0 ) )
In table visual,you can directly drag your field "measure" to visual pane to filter the data.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
In card visual,you need to generate a temporary table and then filter data in this table, please change your new measure as below:
Measure_2 =
VAR tab =
SUMMARIZE ( bonus, Emploloyees[Name], "Headcount", [HEADCOUNT] )
RETURN
CALCULATE ( [HEADCOUNT], FILTER ( tab, [Bonus paid] > 0 ) )
In table visual,you can directly drag your field "measure" to visual pane to filter the data.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
It worked like a glove.
Thanks a lost for the help.
Hi, @Anonymous
Have you tried to use visual filter pane to filter the data?
I'm a little confused by your description.
Please share your sample data and expected output which would help tremendously.
Best Regards,
Community Support Team _ Eason
Hi here is a sample of the pbix
https://www.dropbox.com/s/9uh9z16ua41v9tm/sample.pbix?dl=0
So what i am trying to achive is to have a measure whihc will return the number of active employees who get bonus paid in the last 12 months.
So as i put in the sample, i have:
So I have a measure called HEADCOUNT, which return the number of active employees based in the calendar slice selection.
I also have a measure called BONUS PAID, which returns the total of bonus paid in the last 12 months.
Now based on the number of active employees for that month i need to caount how many get bonus paid in the last 12 monts.
So the expected result would be:
from the 5 employees that ate listed, I have 4 active in JUN/20 and out his 4 , 1 get 0 bonus amount in the last 12 months, so i would like to get as return 3, which reflects the number of employees active who got bonus in the last 12 months.
I has trying to calculate it using the following DAX:
Calculate( [HEADCOUNT], [BONUS PAID] > 0 )
however in the calulate expression is not possible to use a measure in the filter section.
I also tried :
IF( BONUS>0, [HEADCOUNT]) however the result is giving me is 4.
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |