Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Count how many employees whose salary increased

Hi,

 

 

DateEmp IDSalary
01/01/20221011000
01/01/20221021500
01/01/20221032000
01/02/20221015000
01/02/20221021500
01/02/20221033000

 

As you can see from the table above, Employees 101 and 103 have a salary increase. I'd like a measure for a card visual that counts the number of employees who have a salary increase in comparison to the previous month. In this case, the answer will be just 2.

 

I appreciate your help.

 

Thanks in advance.

1 ACCEPTED SOLUTION
pratyashasamal
Super User
Super User

Hi @Anonymous ,
Please create these measures first ,

Measure Last Month = CALCULATE( [Increase count],PREVIOUSMONTH('Table (3)'[Date]))
Measure1 % difference from Salary =
VAR __BASELINE_VALUE = SUM('Table (3)'[Salary])
VAR __VALUE_TO_COMPARE = CALCULATE( SUM('Table (3)'[Salary]),PREVIOUSMONTH('Table (3)'[Date]))
RETURN
    IF(
        NOT ISBLANK(__VALUE_TO_COMPARE),
        DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
    )
Count Measure = 1
Increase count = If( [Salary % difference from Measure1] > 0 , [Count Measure]+1,0)
Use a KPI visual
Now could add "Increase count" in  value , "Date" in Trend axis and "Measure Last month" in Target.
pratyashasamal_0-1670492378039.png

Thanks ,
Pratyasha 
Please mark this as the solution if this is helpful for you .





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
pratyashasamal
Super User
Super User

Hi @Anonymous ,
Please create these measures first ,

Measure Last Month = CALCULATE( [Increase count],PREVIOUSMONTH('Table (3)'[Date]))
Measure1 % difference from Salary =
VAR __BASELINE_VALUE = SUM('Table (3)'[Salary])
VAR __VALUE_TO_COMPARE = CALCULATE( SUM('Table (3)'[Salary]),PREVIOUSMONTH('Table (3)'[Date]))
RETURN
    IF(
        NOT ISBLANK(__VALUE_TO_COMPARE),
        DIVIDE(__VALUE_TO_COMPARE - __BASELINE_VALUE, __BASELINE_VALUE)
    )
Count Measure = 1
Increase count = If( [Salary % difference from Measure1] > 0 , [Count Measure]+1,0)
Use a KPI visual
Now could add "Increase count" in  value , "Date" in Trend axis and "Measure Last month" in Target.
pratyashasamal_0-1670492378039.png

Thanks ,
Pratyasha 
Please mark this as the solution if this is helpful for you .





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

Hi, appreciate if anyone could help. Thanks

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.