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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Ironic_Method
Regular Visitor

Formula Returning a Whole Number Instead of a Fraction

I have a project where I need to find the average number of movies each actor/director pair has done during the director's longevity for all Netflix directors.

I broke down my formula to find out why I can't get the right answer and I found out that when trying to find the director's longevity the result is rounding to the nearest whole number in years instead of 1.47 years or .62 years or the like.

 

This is just one iteration of my attempts to produce a decimal.

DirectorDuration = 
VAR __Table =
    SUMMARIZE(  
        'Netflix',
        'Netflix'[director],
        "FirstDate", MIN('Netflix'[date_added]),
        "LastDate", MAX('Netflix'[date_added])
        
    )
RETURN
        SUMX(
            __Table,
            DATEDIFF(
                DATE(YEAR([FirstDate]), MONTH([FirstDate]), DAY([FirstDate])),
                DATE(YEAR([LastDate]), MONTH([LastDate]), DAY([LastDate])),
                YEAR
            )
    )


I have also tried a few variations of using DAY / 365.25 and still get whole numbers (or 0s if it's less than a year). How do I go about getting some fractions!?

6 REPLIES 6
Ahmedx
Super User
Super User

pls try this

 

DirectorDuration = 
VAR __Table =
    SUMMARIZE(  
        'Netflix',
        'Netflix'[director],
        "FirstDate", MIN('Netflix'[date_added]),
        "LastDate", MAX('Netflix'[date_added])
        
    )
RETURN
        FORMAT(SUMX(
            __Table,
            DATEDIFF(
                DATE(YEAR([FirstDate]), MONTH([FirstDate]), DAY([FirstDate])),
                DATE(YEAR([LastDate]), MONTH([LastDate]), DAY([LastDate])),
                YEAR
            )
    ),"#,##0.00")

 

Interesting that your solution which looks like it forces the decimals goes back to a whole number! (DirectorDuration2)

Ironic_Method_0-1682548868460.png


I appreciate the help nevertheless.

I fixed it, check again

"#,##0.00"

 

 

Unfortunately, it's still giving me 1.00, 0.00, etc. Appreciate the attempt!

vicky_
Super User
Super User

I ran into the same issue a while back. The fix for me was simple - select the measure, go to the "Measure Tools" at the top, and make sure that the data type is set to decimal number, with the number of decimal points you want. 

vicky__0-1682545960394.png

 

I got excited, but alas that didn't solve the issue. Now the results are "1.00, 0.00, 0.00, etc."

For example the data here for Alastair Fothergill shows a longevity of 5.00, but it should be 5.44 based on Aprill 22, 2015 through October 04, 2020.

Ironic_Method_0-1682547006170.png

 



Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.