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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
amal_01
Helper I
Helper I

Measure does not turn any value in power bi (DAX)

I am working on payroll changes monthly using power bi
I have created a measure that gives me a new Employees and thire salaries in the current month 

 

 

New Employements = 
VAR SelectedDate = SELECTEDVALUE('PayStatementEarningLineInquiries'[PeriodStartDate])
VAR SelectedYear = YEAR(SelectedDate)
VAR SelectedMonth = MONTH(SelectedDate)

-- Determine the previous month
VAR PreviousMonthStartDate = 
    IF(
        SelectedMonth = 1,
        DATE(SelectedYear - 1, 12, 1),
        DATE(SelectedYear, SelectedMonth - 1, 1)
    )

VAR PreviousMonthEndDate = 
    IF(
        SelectedMonth = 1,
        EOMONTH(DATE(SelectedYear - 1, 12, 1), 0),
        EOMONTH(DATE(SelectedYear, SelectedMonth - 1, 1), 0)
    )

-- Determine the current month
VAR CurrentMonthStartDate = DATE(SelectedYear, SelectedMonth, 1)
VAR CurrentMonthEndDate = EOMONTH(CurrentMonthStartDate, 0)

-- Calculate Total Earnings for the Previous Month
VAR PreviousMonthEarnings = 
    CALCULATE(
        [TotalEarning meas],
        ALLEXCEPT(
            PayStatementEarningLineInquiries, 
            PayStatementEarningLineInquiries[Worker]
        ),
        '(PayStatementHeaders)'[PeriodStartDate] >= PreviousMonthStartDate,
        '(PayStatementHeaders)'[PeriodStartDate] <= PreviousMonthEndDate
    )

-- Calculate Total Earnings for the Current Month
VAR CurrentMonthEarnings = 
    CALCULATE(
        [TotalEarning meas],
        ALLEXCEPT(
            'PayStatementEarningLineInquiries', 
            'PayStatementEarningLineInquiries'[Worker]
        ),
        '(PayStatementHeaders)'[PeriodStartDate] >= CurrentMonthStartDate,
        '(PayStatementHeaders)'[PeriodStartDate] <= CurrentMonthEndDate
    )

-- Calculate total for all rows
VAR TotalNewEmployments = 
    CALCULATE(
        SUMX(
            'PayStatementEarningLineInquiries',
            IF( (CurrentMonthEarnings -  PreviousMonthEarnings) < 1, CurrentMonthEarnings, BLANK())
        )
    )

RETURN
    TotalNewEmployments
    

 

 

  the measure work correctly 
it shows me the new employees and thire salaries but it does not turn the total of all new employees 

amal_01_0-1727007256221.png


does me measure missing things ?! what should I do to make my measure truns Total Salaries 



1 ACCEPTED SOLUTION
dharmendars007
Super User
Super User

Hello @amal_01 , 

 

Looking at your measure i guess the last condition which you have passed Blanks() is cauing problem, kindly review that

 

 CALCULATE(
        SUMX(
            'PayStatementEarningLineInquiries',
            IF( (CurrentMonthEarnings -  PreviousMonthEarnings) < 1, CurrentMonthEarnings, BLANK())
        )
    )

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @amal_01 ,

 

What is the [TotalEarning meas] field in the formula? Is it possible to provide some test data and describe it so that I can answer you as soon as possible.

 

Best regards, 

Adamk Kong

dharmendars007
Super User
Super User

Hello @amal_01 , 

 

Looking at your measure i guess the last condition which you have passed Blanks() is cauing problem, kindly review that

 

 CALCULATE(
        SUMX(
            'PayStatementEarningLineInquiries',
            IF( (CurrentMonthEarnings -  PreviousMonthEarnings) < 1, CurrentMonthEarnings, BLANK())
        )
    )

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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