Forum Discussion

CapnShanty's avatar
CapnShanty
Frequent Visitor
6 years ago
Solved

Calculated column returning same value for every row?

So I have three calculated columns that feed into eachother: SubcontractorHours, FTEHours, and % Subcontractor.    However, when I put % Subcontractor into my matrix that is fed by my other table, ...
  • v-yingjl's avatar
    6 years ago

    Hi CapnShanty ,

    I'm not certain whether other rows is 0 or blank or maintain their initial value when you create calculated columns to sum hours.

    In my sample, I suppose it to maintain their intial value because if it is 0 or blank the percentage seems meaningless:

    SubcontractorHours = 
    IF(
        BookedHours[User] in DISTINCT(SubcontractorList[User]),
        SUMX(
            FILTER(
                BookedHours,
                BookedHours[User] in DISTINCT(SubcontractorList[User])
            ),
            [Hours]
        ),
        [Hours]
    )
    FTEHours = 
    IF(
        NOT( BookedHours[User] in DISTINCT(SubcontractorList[User]) ),
        SUMX(
            FILTER(
                BookedHours,
                NOT( BookedHours[User] in DISTINCT(SubcontractorList[User]))
            ),
            [Hours]
        ),
        [Hours]
    )
    %Subcontractor = [SubcontractorHours] / ([SubcontractorHours] + [FTEHours])

     

    Sample file is attached, please check and try it: Calculated column returning same value for every row.pbix 

     

    Best Regards,
    Yingjie Li

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.