Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
itsmebvk
Continued Contributor
Continued Contributor

Different level of summary based on slicer value?

 
Hi Folks,
 
I am trying to achieve a requirement, I tried different ways but couldn't reach a solution.
 
Sample Report and File  attached 
 
 
Measure 1 = When I select an Item in Item slicer, I want to get the total of "QTY" of the "Item Line" which selected slicer values belong to.
 
 For example when I select Item 1001 in slicer, it should get Sum(QTY) for all A1  "Item Line"  as 1001 belongs to A1  "Item Line" , in this example it should give 65. 
 
itsmebvamsi_0-1647219610487.png

 

  
A1  "Item Line"   Total itsmebvamsi_1-1647219610488.png

 

 
When I select 1008 it should give total B1 "Item Line" total(QTY) as 1008 belongs to B1 "Item Line" in this case it should give 190
itsmebvamsi_2-1647219610488.png

 

 
B1 "Item Line" itsmebvamsi_3-1647219610488.png

 

 
 
 
  Measure 2 = When I select 1001 it should give Category A total , when I select 1009 it should give Category  B total
 
itsmebvamsi_4-1647219610488.png

 

A total should be 150 itsmebvamsi_5-1647219610488.png

 

 
 
itsmebvamsi_6-1647219610488.png

 

 
B total should be 385 itsmebvamsi_7-1647219610489.png

 

 
These measure should also change based on Date or any other slicer we have in the report..

Please suggest, Thank you.

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@itsmebvk these measures will do it without using Item Line and Item Category  in the table visual

 

Item Line Total = CALCULATE ( SUM ( 'Fact'[QTY] ),  ALLEXCEPT( Dim, Dim[Item Line] ), VALUES ( Dim[Item Line] ) )

Item Category Total = CALCULATE ( SUM ( 'Fact'[QTY] ),  ALLEXCEPT( Dim, Dim[Category] ), VALUES ( Dim[Category] ) )

 

Here is the output if 1001 is selected.

 

parry2k_0-1647351290720.png

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

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.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

13 REPLIES 13
parry2k
Super User
Super User

Hey I am away from my desk. Check my video which came out today and it has a solution using remove filters and that will work, will keep the filter on date but will remove only from item.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@itsmebvk Glad to hear it worked out. As a matter of fact, I did a video on this and that will be out tomorrow (Wednesday, March 16th) and in that video, I went with two alternate solutions, using ALLEXCEPT and REMOVEFILTERS functions.

 

I will post the link to the video here once it is published. Do subscribe to my YT channel, if you haven't already, I usually make videos on real-time business problems or questions asked on the community forum. 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

itsmebvk
Continued Contributor
Continued Contributor

Awesome good to hear that. Yes I already subscribed and following your LinkedIn page. Once again than you and awaiting for new video . 

parry2k
Super User
Super User

@itsmebvk these measures will do it without using Item Line and Item Category  in the table visual

 

Item Line Total = CALCULATE ( SUM ( 'Fact'[QTY] ),  ALLEXCEPT( Dim, Dim[Item Line] ), VALUES ( Dim[Item Line] ) )

Item Category Total = CALCULATE ( SUM ( 'Fact'[QTY] ),  ALLEXCEPT( Dim, Dim[Category] ), VALUES ( Dim[Category] ) )

 

Here is the output if 1001 is selected.

 

parry2k_0-1647351290720.png

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

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.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

itsmebvk
Continued Contributor
Continued Contributor

@parry2k  Apologies.

 

I missed to test one more scenario. I also need to apply a filter on top of the date along with expression mentioned below. But it is returning the value for specific ITem_Line I selected for 😞

 

 

Item Line Total = CALCULATE ( SUM ( 'Fact'[QTY] ),  ALLEXCEPT( Sub Category,Dim, Dim[Item Line] ), VALUES ( Sub Category ) )



Item Line Total = CALCULATE ( SUM ( 'Fact'[QTY] ), filter(Date< Date(2020,01,01)), ALLEXCEPT( Sub Category,Dim, Dim[Item Line] ), VALUES ( Sub Category ) )

 

 

itsmebvk
Continued Contributor
Continued Contributor

@parry2k @lbendlin  Is there anyway we apply this Date(Column in The same Dim table) filter along with Allexcept on same Dim table?

itsmebvk
Continued Contributor
Continued Contributor

@parry2k  Awesome that really worked. Thanks alot for your inputs.

lbendlin
Super User
Super User

Here is a starting point. Adjust as needed .

 

Parent Qty =
CALCULATE (
    SUM ( 'Fact'[QTY] ),
    ALL ( 'Fact' ),
    CALCULATETABLE ( VALUES ( 'Fact'[Item] ), ALLEXCEPT ( Dim, Dim[Item Line] )
)

 

 

itsmebvk
Continued Contributor
Continued Contributor

@lbendlin  Thank you so much for quick reply.

 

Yes, I already did this earlier and it is working at Item_Line level, but this approach is not working when you try to get summary for subcategory or Category it belongs to. is there anything I am missing?

You can use the same approach. The only thing you have to change is the ALLEXCEPT scope.

itsmebvk
Continued Contributor
Continued Contributor

@lbendlin  do you mean like this? it should be 30 instead 855, As I highlighted in screenshot I only want to show ITEM in table not Sub Category and Category. That's where the approach was not working . If I add Sub Category  or Category it works.

 

Sub Cat Total =
CALCULATE (
SUM ( 'Fact'[QTY] ),
ALL ( 'Fact' ),
CALCULATETABLE ( VALUES ( 'Fact'[Item] ), ALLEXCEPT(Dim,Dim[Sub Category] )))
 
itsmebvamsi_0-1647309878407.png

 

Not sure what you do different - it works for me.

 

lbendlin_0-1647348815340.png

pbix attached.

itsmebvk
Continued Contributor
Continued Contributor

@lbendlin really sorry if haven't mentioned that. It was not working because i dont want to Category or Sub Category in table. However your direction helped me alot . Thanks alot for your inputs.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.