Forum Discussion

RPAI2812's avatar
RPAI2812
Icon for Helper I rankHelper I
4 years ago
Solved

Filter with pivoted data doubt

Hi!

 

I need help with the best way of filtering my data with slicers 🙂

 

I have attached the data of two tables in a link at the end of this post. The first table has some operational and costs information of different travels that happened during 2021. I have the month it occurred, number of passengers, the time duration and the cost of this travel in the first table.

 

The second table I have some information of cost allocation for each travel among three different cost centers (CC1, CC2 and CC3). This happens because the costs of the travel depends on which cost center each passenger belongs. For example, if a travel has 5 out of 10 passengers from CC1, 3 from CC2 and 2 from CC3, then the costs will be distributed as 50%, 30% and 20%, respectively.

 

When building my dashboard in powerbi, I would like to be able to apply a slicer of the cost centers.

 

For instance, imagine I create a measure of Total Passengers = SUMX('Table 1', 'Table 1'[Passengers]'). Also, imagine I would create a relationship between Table 1 and Table 2 for the "Travel" column.

What would be the best way to apply a slicer of the cost center, so that if I select CC1, I see the total passengers from CC1 have been transported? So if I select CC1 and CC2, it shows the sum of those two cost centers passengers?

 

I have some toughts on using SELECTEDVALUE, but I don't like this idea as it would make very complex if I had dozens of cost centers.. 

 

Anyway, I would appreciate a lot your help. 🙂  The example data is in this link: Example Data

Happy new year!

3 Replies

  • RPAI2812 is this what you are looking for?

     

     

     

    Follow us on LinkedIn and  to our YouTube channel

     

    Learn about conditional formatting at Microsoft Reactor

    My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • RPAI2812's avatar
      RPAI2812
      Icon for Helper I rankHelper I

      Not a 100% exactly like this, but this is on the way.
      In your solution the measure shows the full amount of passengers of each travel. I needed it to show the amount related to that specific cost center. 

      For instance, Travel 9 I had 10 passengers, being 10% for CC1, 80% for CC2 and 10% for CC3. Instead of always showing Travel 9 with 10 passengers in each of the sliders, what I want would be CC1 showing 1, CC2 showing 8 and CC3 showing 1.

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

        Hi RPAI2812 ,

        Has your problem been solved? If not, your sample link is expired, would you please kindly share it again?

        Best Regards,
        Community Support Team _ kalyj