Forum Discussion

hrlope's avatar
hrlope
New Member
4 years ago
Solved

DAX for addition and division

I want to ADD Append1,[Time Off(Hours)] to Append1[Hours Reported] prior to the division. Any suggestions?

 

VAR _HoursReported = Calculate(SUM(Append1[Hours Reported]),FILTER(Append1, Month(Append1[Reported Date]) = 10))
Var _TicketCount = Calculate(DISTINCTCOUNT(Append1[Number]),FILTER(Append1,Append1[Assignment group] IN {"DC - US - DDC - Hardware","DC - US - EDC - Hardware","DC - US - Impl and Maint DNG/EGV","DC - US - Planners" } && Month(Append1[Created] ) = 10 ))
RETURN
DIVIDE(_HoursReported,_TicketCount,0)

  • hrlope 

    I am not sure how your datamodel is setup but please try the following measure:

    VAR _TimeOff =
        CALCULATE (
            SUM ( Append1[Time Off(Hours)]),
            FILTER ( Append1, MONTH ( Append1[Reported Date] ) = 10 )
        )
    VAR _HoursReported =
        CALCULATE (
            SUM ( Append1[Hours Reported] ),
            FILTER ( Append1, MONTH ( Append1[Reported Date] ) = 10 )
        )
    VAR _TicketCount =
        CALCULATE (
            DISTINCTCOUNT ( Append1[Number] ),
            FILTER (
                Append1,
                Append1[Assignment group]
                    IN {
                        "DC - US - DDC - Hardware",
                        "DC - US - EDC - Hardware",
                        "DC - US - Impl and Maint DNG/EGV",
                        "DC - US - Planners"
                    }
                        && MONTH ( Append1[Created] ) = 10
            )
        )
    RETURN
        DIVIDE ( _HoursReported  + _TimeOff, _TicketCount, 0 )
    



2 Replies

  • hrlope 

    I am not sure how your datamodel is setup but please try the following measure:

    VAR _TimeOff =
        CALCULATE (
            SUM ( Append1[Time Off(Hours)]),
            FILTER ( Append1, MONTH ( Append1[Reported Date] ) = 10 )
        )
    VAR _HoursReported =
        CALCULATE (
            SUM ( Append1[Hours Reported] ),
            FILTER ( Append1, MONTH ( Append1[Reported Date] ) = 10 )
        )
    VAR _TicketCount =
        CALCULATE (
            DISTINCTCOUNT ( Append1[Number] ),
            FILTER (
                Append1,
                Append1[Assignment group]
                    IN {
                        "DC - US - DDC - Hardware",
                        "DC - US - EDC - Hardware",
                        "DC - US - Impl and Maint DNG/EGV",
                        "DC - US - Planners"
                    }
                        && MONTH ( Append1[Created] ) = 10
            )
        )
    RETURN
        DIVIDE ( _HoursReported  + _TimeOff, _TicketCount, 0 )
    



    • hrlope's avatar
      hrlope
      New Member

      Fowmy, This worked wonderfully. Thank you ever so much...