Forum Discussion

farooqk's avatar
farooqk
Regular Visitor
3 years ago
Solved

Many to one relationship duplicate value

I have this data: Date MasterCategory SubCategory Amount 8-August-2022 Food Grocery 200 8-August-2022 Food Grocery 31 8-August-2022 Food Restaurant 40 8-August-2022 Shopp...
  • VahidDM's avatar
    3 years ago

    Hi farooqk 

    Please remove the relationship first, then use this DAX expression to create a new table:

    New Table = 
    VAR _Date =
        VALUES ( Data[Date] )
    VAR _Cat =
        SUMMARIZE ( Data, Data[MasterCategory], Data[SubCategory] )
    RETURN
        ADDCOLUMNS (
            CROSSJOIN ( _Date, _Cat ),
            "Amount", CALCULATE ( SUM ( Data[Amount] ), KEEPFILTERS ( Data[Date] ) ) + 0
        )
    

     

    The output:

     

     

     

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

    Appreciate your Kudos!! 

    LinkedIn | Twitter | Blog | YouTube