The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi, Not sure if it is possible, but id like a column here which based on the parameter selected does a total of the matching grouping:
So in the case below, now that product group is selected, I need a colum which for A,D,G,J all show the total sales value for "Bike", which is the corresponding product group that they are connected to etc.
In case I was doing it by sub product group, the total for F and L for instance would show the total for "Bad coffe"
pbix file with data can be found here
Solved! Go to Solution.
Managed to solve it my self 🙂
Solution pbix
Created the following measure:
Sales by selected parameter =
VAR _SelectedParameter =
SELECTEDVALUE ( Parameter[Parameter Order] )
VAR _CurrentDimension =
SWITCH (
_SelectedParameter,
0, SELECTEDVALUE ( DimArticle[Product group] ),
1, SELECTEDVALUE ( DimArticle[sub product group] ),
2, SELECTEDVALUE ( 'Fact Sales'[Customer] )
)
VAR _TotalSales =
SWITCH (
_SelectedParameter,
0,
SUMX (
FILTER (
ALL('Fact Sales'),
RELATED ( DimArticle[Product group] ) = _CurrentDimension
),
'Fact Sales'[Sales Value]
),
1,
SUMX (
FILTER (
ALL('Fact Sales'),
RELATED ( DimArticle[sub product group] ) = _CurrentDimension
),
'Fact Sales'[Sales Value]
),
2,
SUMX (
FILTER (
ALL('Fact Sales'),
'Fact Sales'[Customer] = _CurrentDimension
),
'Fact Sales'[Sales Value]
)
)
RETURN
_TotalSales
Managed to solve it my self 🙂
Solution pbix
Created the following measure:
Sales by selected parameter =
VAR _SelectedParameter =
SELECTEDVALUE ( Parameter[Parameter Order] )
VAR _CurrentDimension =
SWITCH (
_SelectedParameter,
0, SELECTEDVALUE ( DimArticle[Product group] ),
1, SELECTEDVALUE ( DimArticle[sub product group] ),
2, SELECTEDVALUE ( 'Fact Sales'[Customer] )
)
VAR _TotalSales =
SWITCH (
_SelectedParameter,
0,
SUMX (
FILTER (
ALL('Fact Sales'),
RELATED ( DimArticle[Product group] ) = _CurrentDimension
),
'Fact Sales'[Sales Value]
),
1,
SUMX (
FILTER (
ALL('Fact Sales'),
RELATED ( DimArticle[sub product group] ) = _CurrentDimension
),
'Fact Sales'[Sales Value]
),
2,
SUMX (
FILTER (
ALL('Fact Sales'),
'Fact Sales'[Customer] = _CurrentDimension
),
'Fact Sales'[Sales Value]
)
)
RETURN
_TotalSales
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
79 | |
71 | |
48 | |
41 |
User | Count |
---|---|
138 | |
108 | |
71 | |
64 | |
58 |