Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello
Is there a way I can filter the data from the below table based on how many locations a product is sold? For instance, I would like to filter the data visualised by:
Also, Is there a way I can add a filter to my dashboard where if I select two or more locations specifically, the data is filtered to products sold specifically to both or more locations selected (excludes products sold just to one of the selected locations)?
| Table Name: | Product Sales | |||
| Product ID | No of Units | Total Value | Sale Date | Location |
| Product 1 | 10 | 500 | 15/07/2022 | Location 1 |
| Product 2 | 5 | 250 | 16/07/2022 | Location 2 |
| Product 3 | 2 | 100 | 17/07/2022 | Location 1 |
| Product 4 | 4 | 200 | 18/07/2022 | Location 1 |
| Product 1 | 2 | 100 | 19/07/2022 | Location 2 |
| Product 2 | 4 | 200 | 20/07/2022 | Location 3 |
| Product 3 | 3 | 150 | 21/07/2022 | Location 2 |
| Product 4 | 8 | 400 | 22/07/2022 | Location 1 |
| Product 1 | 7 | 350 | 23/07/2022 | Location 3 |
| Product 2 | 7 | 350 | 24/07/2022 | Location 2 |
| Product 3 | 4 | 200 | 25/07/2022 | Location 3 |
| Product 4 | 4 | 200 | 26/07/2022 | Location 1 |
| Product 1 | 7 | 350 | 23/07/2022 | Location 4 |
| Product 2 | 7 | 350 | 24/07/2022 | Location 2 |
| Product 3 | 4 | 200 | 25/07/2022 | Location 3 |
| Product 4 | 4 | 200 | 26/07/2022 | Location 1 |
Solved! Go to Solution.
For fun only, a showcase of powerful Excel worksheet formula,
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi @donodackal,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
For fun only, a showcase of powerful Excel worksheet formula,
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi,
First create a separate, single-column table to be used as a filter which comprises integers from one up to the maximum number of locations you would like to filter for (four, in your example). Assuming this table and its only column are both named 'Unique Location Count', create this measure:
MyMeasure =
VAR UniqueLocationCount =
SELECTEDVALUE( 'Unique Location Count'[Unique Location Count] )
VAR MyTable =
ADDCOLUMNS(
SUMMARIZE( 'Product Sales', 'Product Sales'[Product ID] ),
"Unique Locations",
CALCULATE(
DISTINCTCOUNT( 'Product Sales'[Location] ),
ALLEXCEPT( 'Product Sales', 'Product Sales'[Product ID] )
)
)
RETURN
SUMX( MyTable, 0 + ( [Unique Locations] = UniqueLocationCount ) )
which can then be dragged into the filters pane for your main visual and set equal to 1.
Of course, you could also dynamically derive the table 'Unique Location Count' from your dataset instead of creating it statically.
Regards
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |