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

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.

Reply
Suchitkotak
Regular Visitor

Power BI Custom column and measure incorrect values but correct subtotal

I have a power BI dashboard for employee attrition, where I have created a measure that calculates attrition percentage and a custom column that is Date difference of leaving and Date of Joining (Tenure). This measure show correct output when I use it with my date column, but when I use my Tenure column it is not giving me correct output. The subtotal it shows is correct but when I manually add up the rows it does not sum up to the subtotal.

2 REPLIES 2
pratyashasamal
Super User
Super User

Hi @Suchitkotak ,
This sounds a use with relationship inbetween the tables . I think there is a relationship between one date column and calender table and the tenture does not have any relationship .
In this senario you need to create a inactive relationship with tenture date column .
Please refer to this link :-
https://learn.microsoft.com/en-us/power-bi/guidance/relationships-active-inactive

Thanks ,
Pratyasha Samal
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C





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

Proud to be a Super User!





Thank you for your response @pratyashasamal , actually Tenure is a custom created column which consists of bucket values like "1-3 years", "3-5 years" etc depending on how many years employee is in the firm. DAX code is like this:

VAR DateDiffYears = DATEDIFF('Emp'[DOJ],'Emp'[DOL], YEAR)
RETURN
    SWITCH(
        TRUE(),
        ISBLANK(DateDiffYears), "NA",
        DateDiffYears = 0, "0 to 1 year",
        AND(DateDiffYears>= 1,DateDiffYears<3), "1 to 3 years",
        AND(DateDiffYears >= 3, DateDiffYears < 5), "3 to 5 years",
        AND(DateDiffYears >= 5, DateDiffYears< 10), "5 to 10 years",
        DateDiffMonths >10, "More than 10 years"
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.