Forum Discussion

IoanCosmin's avatar
IoanCosmin
Icon for Helper III rankHelper III
8 years ago
Solved

Calculate where type clause from two different tables

I haven't written DAX in a while and I'm having a bit of a hard time putting this together and I am hoping someone could throw in a suggestion. What I have: Qty Table (a lot more months than Januar...
  • Zubair_Muhammad's avatar
    8 years ago

    Hi IoanCosmin

     

    Please see the attached file here. Hope it helps

     

    Here are the steps

     

    First I added a Caclulated Column in QtyTable

     

    Month =
    MONTH ( QtyTable[Date] )

    Second, a MEASURE in QtyTable to get the LaborRate for the months

     

    LaborRate =
    CALCULATE (
        VALUES ( RatesTable[Amount] ),
        FILTER (
            RatesTable,
            SELECTEDVALUE ( QtyTable[Month] ) >= MONTH ( RatesTable[DateFrom] )
                && SELECTEDVALUE ( QtyTable[Month] ) <= MONTH ( RatesTable[DateTo] )
                && SELECTEDVALUE ( QtyTable[Location] ) = RatesTable[Location]
        )
    )

    Thirdly a MEASURE to get the RESULT

     

    RESULTT =
    SUM ( QtyTable[LaborQty] ) * [LaborRate]