Forum Discussion
Measure or count in Y Axis
- 3 years ago
Ah thanks, now I get it. I have a possible way how you could present this in a bar chart (not sure if this is the most optimal method).
- Add a parameter table to your model.
- Place the parameter column on the y-axis. This column refers to the number of different products (1, 2, 3, etc)
- Create a new measure, where you count the number of stores for every number of different products it sells.
Nb of stores = COUNTROWS ( FILTER ( DISTINCT ( 'Table'[Store] ), VAR _store = 'Table'[Store] VAR _product = SELECTEDVALUE ( Parameter[Parameter] ) VAR _products = CALCULATE ( DISTINCTCOUNT ( 'Table'[Product] ), REMOVEFILTERS ( 'Table' ), 'Table'[Store] = _store ) VAR _result = _products = _product RETURN _result ) ) Place the measure on the x-axis and this is your result:
- Add a parameter table to your model.
You can aggregate the stores by placing them on the x-axis and taking the 'count' of them, for example. This is not possible for the y-axis, it must always be categorical. You could place the different products here. The bar chart now shows the number of stores per product:
It is only possible to show the number of both at the same time if they are both on the x-axis:
You could possibly place a shared categorical variable on y-axis. For example a date. This way you show the number of stores and products by date:
If this isn't what you're looking for, could you please send an image of what you're trying to create?
Thanks Barthel, here is an exemple to be clearer:
| Store | Product |
| A | X |
| A | Y |
| A | Z |
| B | X |
| C | Y |
| C | Z |
| D | X |
| D | Z |
so i would like a visual showing this:
| Nb product | Nb store |
| 1 | 1 |
| 2 | 2 |
| 3 | 1 |
thanks!
- Barthel3 years ago
Solution Sage
I don't seem to understand how the second table follows from the first. Could you explain this?
- nonoFRissy853 years agoRegular Visitor
yes of course:
there is one store selling one product (B)
there is two stores selling two products (C and D)
there is one store selling three products (A)
- Barthel3 years ago
Solution Sage
Ah thanks, now I get it. I have a possible way how you could present this in a bar chart (not sure if this is the most optimal method).
- Add a parameter table to your model.
- Place the parameter column on the y-axis. This column refers to the number of different products (1, 2, 3, etc)
- Create a new measure, where you count the number of stores for every number of different products it sells.
Nb of stores = COUNTROWS ( FILTER ( DISTINCT ( 'Table'[Store] ), VAR _store = 'Table'[Store] VAR _product = SELECTEDVALUE ( Parameter[Parameter] ) VAR _products = CALCULATE ( DISTINCTCOUNT ( 'Table'[Product] ), REMOVEFILTERS ( 'Table' ), 'Table'[Store] = _store ) VAR _result = _products = _product RETURN _result ) ) Place the measure on the x-axis and this is your result:
- Add a parameter table to your model.