Forum Discussion

dogba's avatar
dogba
Frequent Visitor
1 year ago
Solved

Get table total as column while having filter condition from related table slicer (ALLSELECTED)

Consider 2 Tables: 

Fact Table: 

PolicyValue
A100
B200
C300
D400
E500

 

Dimension Table: 

PolicyRegion
AUS
BUK
CEMEA
DUS
EUK


Both tables related on key - "Policy"

For my table visual, I would like to calculate a simple measure "New Measure" which gives me the total of the entire table as a separate column. As such: 

PolicyValueNew Measure
A1001500
B2001500
C3001500
D4001500
E5001500


Measure Used: 

New Measure = CALCULATE(SUM('FACT'[Value]), ALLSELECTED('FACT'))


However, I have region (from dimension table) as slicer in my report page. This is somehow breaking the table and returning all rows 

Above screenshot, can see even on selecting EMEA, I get all five records. I have a feeling it is doing some sort of cartesian join when using ALLSELECTED.

Expected Behavior: I would like the region slicer to work but see the table total as a different column. 

 


How can I achieve this? 

Hopefully, question makes sense - happy to provide more details. Thank you. 

Note: Example has been simplified - original use case has multiple dimension tables and fact table has a few million records. Hence, I would need a scalable solution. 

Pbix: Link

Edit: I would need to have the Policy field in my final visual come from table - FACT (not DIM). The original relationship between two is not on this field hence they're not interchangeable. 

  • hello dogba 

     

    i might be misunderstood but i am using your DAX but get different result with EMEA.

     

    Have you created a relationship between fact and dim table?

    it is one-to-one in my screenshot, but in your original table it most likely one-to-many from dim to fact table.

     

    Hope this will help.

    Thank you.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi dogba 
    Thank you for reaching out microsoft fabric community forum.

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

9 Replies

  • Irwan's avatar
    Irwan
    Super User

    hello dogba 

     

    i might be misunderstood but i am using your DAX but get different result with EMEA.

     

    Have you created a relationship between fact and dim table?

    it is one-to-one in my screenshot, but in your original table it most likely one-to-many from dim to fact table.

     

    Hope this will help.

    Thank you.

    • dogba's avatar
      dogba
      Frequent Visitor

      Thank you for your response - can you see my reply above? 
      I think my question was unclear - the Policy field must come from FACT table in the final table visual as the original relationship is on a different category field. 
      I will update my question but hopefully it is clearer this time - is this possible to achieve?

      • Irwan's avatar
        Irwan
        Super User

        hello dogba 

         

        if you want to filter out a value like you have shown in expected behaviour, your need a value in table visual that has a relationship from your dim tabl.

         

        from your updated question, seems there is no relationship between your sample data (the relationship goes to another column which is not shown in sample data).

         

        please share a sample data that represent your original data.

        there might be a way around to achive your requirement (consume Policy from fact tbl).

         

        Thank you.

    • dogba's avatar
      dogba
      Frequent Visitor

      Thank you for your response. Your solution works but in my table visual, I need the field Policy to come from FACT table (not DIM). Realise my example may have been a little too simple as my original relationship is not on the policy field but a different category. As such, this would not allow me to use Policy field from the region dimension table. 

      This is what I am getting on using Policy from FACT table (note how measure returns row total and not overall total)


      Is there any way to achieve this?

      • Ashish_Excel's avatar
        Ashish_Excel
        Solution Supplier

        You are welcome.  That is not the right table to drag it from.  That field should be dragged from the Dim table.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dogba 
    Thank you for reaching out microsoft fabric community forum.

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

    • v-achippa's avatar
      v-achippa
      Community Support

      Hi dogba,

       

      As we haven’t heard back from you, we wanted to kindly follow up to check if the issue is resolved?
      If any response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

       

      Thanks and regards,

      Anjan Kumar Chippa

      • v-achippa's avatar
        v-achippa
        Community Support

        Hi @dogba,

         

        We wanted to kindly follow up to check if the issue is resolved?
        If any response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

         

        Thanks and regards,

        Anjan Kumar Chippa