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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Rabi
Resolver I
Resolver I

Measure Does Not work Properly.

Full NameContract Hours

Worked Hours

Pay date
ABC

76

7.615/01/2024
ABC767.615/01/2024
ABC761415/01/2024
JOHN42628/01/2024
JOHN422528/01/2024
JOHN42328/01/2024

 

Hi Everyone, 

 

Above is the sample data of the timesheet.

I am getting correct results when i have a single pay date selected but when i add the same measure in matrix and add pay date in the column, i am not getting correct results I am not sure why.

 

1 st measure to calculate Hours Worked

 

Worked Hours= sum('Table A'[Worked Hours])

 

2nd measure to calculate contract hours as Contract hours is done for fortnight

 

Contract Hours = 
    SUMX(
        SUMMARIZE(
            'Table A', 
            'Table A'[Full Name], 
            "CONTRACT", max('Table A'[Contract Hours])
        ), 
        [CONTRACT]
    )

 

 3 rd to calculate difference

 

Difference= [Worked Hours]-[Contract Hours]

 

I am checking the variance of the hours so in the matrix i am doing Difference is less than 0 in the filter. 

FEFEF.png

 

Please can someone help me with this

Thanks verymuch !!

1 ACCEPTED SOLUTION

Hi @Rabi ,

You can create another measure as below and apply a visual-level filter to filter the data which [Difference] is less than 0. Please find the details in the attachment.

Flag = IF( MINX(ALLSELECTED('SAMPLE'[Pay date]),[Difference]) < 0, 1)

vyiruanmsft_0-1716365944506.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yiruan-msft
Community Support
Community Support

@Mahesh0016  Thanks for your contribution on this thread.

Hi @Rabi ,

I created a sample pbix file(see the attachment) base on your provided sample data and measures, it can return the expected result. How did you set your matrix visual? Is something missing here?

vyiruanmsft_1-1716276729853.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yiruan-msft  can you please have a look at this thread https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Same-DAX-measure-gives-different-Res... i have attached a sample PBIX with the result i want to achieve.

 

Thank you !!

Hi @Rabi ,

You can create another measure as below and apply a visual-level filter to filter the data which [Difference] is less than 0. Please find the details in the attachment.

Flag = IF( MINX(ALLSELECTED('SAMPLE'[Pay date]),[Difference]) < 0, 1)

vyiruanmsft_0-1716365944506.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yiruan-msft , I appreciate your help, But I need to have only negative values in the matrix as I have thousands of employee data to show.

 

Thanks !!

Mahesh0016
Super User
Super User

Hello @Rabi,

Could you please share the expected output? This will help us better understand the problem.

@Mahesh0016   can you please have a look at this thread https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Same-DAX-measure-gives-different-Res... i have attached a sample PBIX with the result I want to achieve

 

Thank you !!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors