Forum Discussion

naoyixue1's avatar
naoyixue1
Post Patron
2 years ago
Solved

How to create a virtual table based on one column value I selected

Hey all,

 

I try to create a table based on the version I selected (see below example). I also created a reference table for version in below in blue. 

If I select version 2 in sales table, I will only see SKU A and B with value 17 and 10 separately. 

 

GIven that, I created a virtual table , but it doesn't work. Would you take a look and let me know if any other thoughts

CALCULATETABLE(SUMMARIZE('Sales Table','Sales Table'[SKU],'Sales Table'[Value]),'Sales Table'[Version]=SELECTEDVALUE(Version[Version]))

6 Replies

  • Sorry, I just corrected my dax to create a virutal table as below. But still doesn't work. 

     

    CALCULATETABLE(SUMMARIZE('Sales Table','Sales Table'[SKU],'Sales Table'[Value]),filter('Sales Table','Sales Table'[Version]=SELECTEDVALUE(Version[Version])))
    • Anand24's avatar
      Anand24
      Super User

      naoyixue1 ,
      You don't need a separate table at all in your case. If you are using a table/matrix and pulling fields from related tables, it will simply show the values based on slicer selection.

      Even if you create a calculated table (which AFAIK can't be created on slicer selection), you will have to create a relationship with the original table from where you are pulling the field in slicer. 

      • naoyixue1's avatar
        naoyixue1
        Post Patron

        So what's your saying is I can create the fair share at SKU level at the original table, which will change based on the version I selected? Let me try that. Thanks!

  • Hi naoyixue1 ,
    When selecting version 2, should it show just A, B or should it show A, B, C with 17, 10, 10 respectively? 

    Also, if you have a single table, your table/matrix visual will automatically show only those relevant values when using version slicer. You actually don't need to create a separate table for it.

     

    Give a thumbs up if this post helped you in any way and mark this post as solution if it solved your query !!!

     

     

    • naoyixue1's avatar
      naoyixue1
      Post Patron

      Sorry, yes, if selecting version 2, we should see A, B and C with 17,10 and 10 separately. I actually try to calculate the sku level fair share based on the selection. That's why I'm thinking I might create a virtual table to only highlight the version of data as I selected. In the real data, there are also columns of month and customers. But just curious whether there is some way for me to do so using calculateable summarize with selectedvalue dax...