Forum Discussion
Not able to cross filter data between Dimension and FACT table
- 1 year ago
Hi Pawanw511 , Thank you for reaching out to the Microsoft Community Forum.
Please try below:
TotalAmount =
CALCULATE(
SUM(fact_amount[amnt]),
ALL(fact_amount)
)
If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi Pawanw511 ,Thank you for reaching out to Microsoft Fabric Community Forum.
- The issue you're encountering is that using ALLSELECTED(dim_account[account_combo]) is causing the removal of filters from the dim_account table and therefore returning the sum for all accounts instead of just the ones the user has access to.
- To fix this and ensure that the TotalAmount calculation respects the RLS (Row Level Security) filters applied to both the dim_account and fact_amount tables, you should consider using the ALL function on the appropriate table while retaining the filters from the other tables.
Please try this:
TotalAmount =
CALCULATE(
SUM(fact_amount[amnt]),
REMOVEFILTERS(fact_amount),
FILTER(
ALL(dim_account),
dim_account[account_combo] IN VALUES(dim_account[account_combo])
)
)
- REMOVEFILTERS(fact_amount) ensures that the sum calculation respects only the filters in the dim_account table and the context of the user’s access.
- The combination of ALL(dim_account) and the FILTER function ensures that we’re only considering accounts visible to the user and that those accounts are filtered correctly based on the RLS rules.
If this post helps, please mark it ‘Accept as Solution’, so others with similar queries may find it more easily. If not please share the details.
v-hashadapu
thanks for reply
with this solution, rows filtered out but the TotalAmount value and Amount value is same