Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
VAR CombinedTable = FILTER(UNION(
SELECTCOLUMNS( VALUES('TOPN (Group)'[Group]),"DynamicValue",'TOPN (Group)'[Group],"Name","Group"),
SELECTCOLUMNS( VALUES('TOPN (Job Family)'[Job Family]),"DynamicValue",'TOPN (Job Family)'[Job Family],"Name","Job Family")
),
[Name] = MAX('Dimension'[Dimension Slicer])
)
VAR Result = MAXX(CombinedTable,SWITCH(SELECTEDVALUE('Measure Slicer'[Slicer]),
"Amount", [Amount],
"Net", [Net]
)
)
Return
ResultHello @Silvard,
Can you please try this updated approach:
VAR CombinedTable =
FILTER(
UNION(
SELECTCOLUMNS(VALUES('TOPN (Group)'[Group]), "DynamicValue", 'TOPN (Group)'[Group], "Name", "Group"),
SELECTCOLUMNS(VALUES('TOPN (Job Family)'[Job Family]), "DynamicValue", 'TOPN (Job Family)'[Job Family], "Name", "Job Family")
),
[Name] = SELECTEDVALUE('Dimension'[Dimension Slicer])
)
VAR Result =
MAXX(
CombinedTable,
SWITCH(
TRUE(),
SELECTEDVALUE('Measure Slicer'[Slicer]) = "Amount", [Amount],
SELECTEDVALUE('Measure Slicer'[Slicer]) = "Net", [Net]
)
)
RETURN
Result
Thank you for assisting.
This doesn't work unfortunately.
The issue doesn't lie in using MAX to get the value selected (I've confirmed this is working), neither is the issue that in my initial post, I had named the job family column as group rather than job family (although you have correctly corrected this- thank you).
I believe the issue lies in the utilisation of Union - if you remove Union and the subsequent below, it correctly iterates over the table but as is, whether using minx or maxx, I get the same result. To me it seems like the row context is missing? I'm fairly new to power bi so still trying to learn.
SELECTCOLUMNS(VALUES('TOPN (Job Family)'[Job Family]), "DynamicValue", 'TOPN (Job Family)'[Job Family], "Name", "Job Family")
)
Essentially, I would like to be able to select any column in my model and apply iteration over that specific column but it's proving very challenging as Iterators and table functions like Addcolumns,selectcolumns don't accept switch or if statements.
I would greatly appreciate your continued assistance.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 23 | |
| 14 | |
| 10 | |
| 6 | |
| 5 |