Forum Discussion
farooqk
3 years agoRegular Visitor
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...
- 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!!
VahidDM
Super User
3 years agoHi 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!!
farooqk
3 years agoRegular Visitor
Thanks for the help!