Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Writing Dax Measure by comparing 2 columns from different tables

Hello,   I have created dummy tables for a good understanding. There are 2 tables : DimDate and Fact_Storage.        Here DimDate table has a Datekey. Fact_storage  tabl...
  • marcelsmaglhaes's avatar
    3 years ago

    Hi Anonymous 

    I don't know if I understand your needs, but you can write a mesaure like that:

    Measure =
    VAR __DATE = SELECTEDVALUE(d_date[data_key])
    VAR __CALC =
    CALCULATE(
                SUM(f_storage[Weight]),
                ALL(f_storage),
                f_storage[data_in_key] < __DATA && f_storage[date_out] = BLANK())
    RETURN
    __CALC


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

     

    Kind Regards,
    Marcel Magalhães

  • Anonymous's avatar
    Anonymous
    3 years ago

    Thnx marcelsmaglhaes amitchandak ,

    The use of Crossfilter and selected value both worked. 

    This measure worked, 

    var dateshow = SELECTEDVALUE(DimDate[DateKey])
     
    return

    CALCULATE(SUM(FactStorage[MaterialWeightKG]),
    CROSSFILTER(DimDate[DateKey], FactStorage[DateInKey], None),
    FactStorage[DateInKey]<=dateshow && (FactStorage[DateOutKey]>dateshow || FactInventory[DateOutKey]=BLANK()))