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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LucaixBolha
Resolver I
Resolver I

How to create a table from slicers with individually selected data and quantities

Hi folks! 

I have a database with more or less 500 assets codes, and would like to create a table/matrix resulting from the selection of the users (so that I could find differences with another table). 
The ideia would be more or less like this, the slicer to the left refers to the asset's code, and the one to the right to its respective quantity:
LucaixBolha_0-1660314119841.png


In this case, the expected result of the table/matrix would be:

Asset         Value
ALPA4           1

AMAR3         4 

Total             5   (it doesn't have necessarily to have a total value)

Does anyone have an ideia if anything like it would be possible?
Thanks!

P.s.: I'm trying to do reproduce the functionality of a sheet in excel (this is why I'm trying to do something more likely to a "cell" context) 

1 ACCEPTED SOLUTION

Hi @LucaixBolha 

 

You need to have individual tables for these slicers to make them not affect each other. In addition, add another Dim Asset table which has all distinct asset values and use it in the table/matrix visual. 

vjingzhang_0-1660720183830.png

 

Then create the following measure and add it into the same table/matrix visual. I have attached a sample pbix file at bottom for download. 

Quantity = 
VAR _asset1 = SELECTEDVALUE('Asset Code 1'[Asset 1])
VAR _asset2 = SELECTEDVALUE('Asset Code 2'[Asset 2])
RETURN
SWITCH(TRUE(),
    SELECTEDVALUE('Dim Asset'[Asset])=_asset1,SELECTEDVALUE('Value 1'[Value 1]),
    SELECTEDVALUE('Dim Asset'[Asset])=_asset2,SELECTEDVALUE('Value 2'[Value 2]),
    BLANK()
    )

vjingzhang_1-1660720523716.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

If you wnat to show some value only when slicer is selected then this might help you.
Switch(true(),allselected('table name'[Pesquisar])="ALPA4", THE VALUE YOU WANT TO ALOT WHEN ALPA4 IS SELECTED IN A SLICER, )
You can write as many conditions you want.

Thank you for your answer @Anonymous !

I tried to figure out a solution with your suggestion, but unfortunately I haven't yet solved my problem. I liked your idea a lot but, since I'm trying to do it dynamically, to allot the quantity value of the slicer to each Asset Code (like ALPA4) would be impracticable because 1) Assets Codes can vary over time, and 2) there's almost 600 of them, what makes it hard to do a measure with every single value 😅


So I replicated the Assets Codes and a series of numbers, in order to attach quantities to each code: 

LucaixBolha_0-1660570348785.png

LucaixBolha_1-1660570367274.png

After I did a measure based on your suggestion: 

LucaixBolha_2-1660570406993.png

But it didn't work; the selected Assets Codes only show up when I select all of them simultaneously in all slicers (and the correct quantities do not follow their respective Assets' Codes).

LucaixBolha_4-1660570680848.png


Maybe I'm not looking to the problem within the right perspective: I was searching to do a table/matrix that would only add information from each slicer selection, but I think that it wouldn't be possible the way I'm doing it, since slicers restrain information instead of expanding it. The expected result would be like this (if it would be possible to not restrain information, so in that way I would be able to select only one code per slicer):

LucaixBolha_3-1660570433795.png

 

Would love to hear your thoughts on it (and from anyone else interested in it also, of course)!
Thanks! 🙏

 



Hi @LucaixBolha 

 

You need to have individual tables for these slicers to make them not affect each other. In addition, add another Dim Asset table which has all distinct asset values and use it in the table/matrix visual. 

vjingzhang_0-1660720183830.png

 

Then create the following measure and add it into the same table/matrix visual. I have attached a sample pbix file at bottom for download. 

Quantity = 
VAR _asset1 = SELECTEDVALUE('Asset Code 1'[Asset 1])
VAR _asset2 = SELECTEDVALUE('Asset Code 2'[Asset 2])
RETURN
SWITCH(TRUE(),
    SELECTEDVALUE('Dim Asset'[Asset])=_asset1,SELECTEDVALUE('Value 1'[Value 1]),
    SELECTEDVALUE('Dim Asset'[Asset])=_asset2,SELECTEDVALUE('Value 2'[Value 2]),
    BLANK()
    )

vjingzhang_1-1660720523716.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thank you very much @v-jingzhang! It was exactly this that I was trying to do 😄 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.