Forum Discussion

riteshgaur's avatar
riteshgaur
Frequent Visitor
7 years ago
Solved

Union two tables based on Slicer

Hi All,

 

I am new to Power BI world.

My requirment is to display a SLICER with Key values which has Year part like Rxxxxx17xxxx, now based on slicer selected value, I have to display data for Rxxxxx17xxxx and Rxxxxx18xxxx (next year) in matrix.

 

So,

- created a slicer

- created one table (Current) which picks Rxxxxx17xxxx 

- created another table (Next) which pick Rxxxxx18xxxx 

These data are perfectly displayed in their individual tables.

 

Now, I need to combine maybe by using UNION, which i tried but it displays all keys. When I do some relationship with either Current or Next, then it displays either records.

How should I achieve my goal, please help?

 

This is code for Combine Table:

 

Table_Combine = DISTINCT(FILTER(UNION(SELECTCOLUMNS(Table_Current, "RiskReference",Table_Current[RiskReference]),SELECTCOLUMNS(Table_Next,"RiskReference",Table_Next[RiskReference])),NOT ISBLANK([RiskReference])))

 

 

  • Hi riteshgaur ,

     

    Do not know your requirement, have you build relationship or add an index column to the two tables? If you have, you may drag columns to chrart directly.

     

    Regards,

    Jimmy Tao

3 Replies

    • riteshgaur's avatar
      riteshgaur
      Frequent Visitor

      Hi Manohar,

       

      RiskKey            Amount

      RAB17001       100.00

      RAB18001       200.00

      BUJ17001        239.00

      BUJ18001        344.00

       

      So, If in Slicer fro RiskKey, RAB17001 is selected, which is for year 2017, report should display RAB17001 and RAB18001 data.

      I manage to display them in seperate table but not able to display together.

       

      Thanks in advance.

       

      RG

        

      • v-yuta-msft's avatar
        v-yuta-msft
        Icon for Community Support rankCommunity Support

        Hi riteshgaur ,

         

        Do not know your requirement, have you build relationship or add an index column to the two tables? If you have, you may drag columns to chrart directly.

         

        Regards,

        Jimmy Tao