<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Union and iterate in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385738#M174104</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="501067" data-lia-user-login="Sahir_Maharaj" class="lia-mention lia-mention-user"&gt;Sahir_Maharaj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for assisting.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This doesn't work unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;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.&lt;/P&gt;&lt;PRE&gt;SELECTCOLUMNS(VALUES('TOPN (Job Family)'[Job Family]), "DynamicValue", 'TOPN (Job Family)'[Job Family], "Name", "Job Family")
        )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would greatly appreciate your continued assistance.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2025 08:21:20 GMT</pubDate>
    <dc:creator>Silvard</dc:creator>
    <dc:date>2025-01-29T08:21:20Z</dc:date>
    <item>
      <title>Union and iterate</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385321#M174070</link>
      <description>&lt;DIV&gt;I’m trying to work out how to use an iterator over a dynamic table/column.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have a fields parameter table to select the dimension to use in the visual (this contains 30 dimensions) and just a normal slicer for the measure (hence using selectedvalue).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The below is the structure that I’m trying to use, but there seems to be an issue using union as when I remove it and only use one column, I get the row with the maximum value rather than the total maximum value that I otherwise seem to get.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The Filter function is working correctly (confirmed in DAX Query) and generates the relevant rows.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;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 
Result&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Jan 2025 00:56:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385321#M174070</guid>
      <dc:creator>Silvard</dc:creator>
      <dc:date>2025-01-29T00:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Union and iterate</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385708#M174101</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="803517" data-lia-user-login="Silvard" class="lia-mention lia-mention-user"&gt;Silvard&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please try this updated approach:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 29 Jan 2025 07:50:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385708#M174101</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2025-01-29T07:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Union and iterate</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385738#M174104</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="501067" data-lia-user-login="Sahir_Maharaj" class="lia-mention lia-mention-user"&gt;Sahir_Maharaj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for assisting.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This doesn't work unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;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.&lt;/P&gt;&lt;PRE&gt;SELECTCOLUMNS(VALUES('TOPN (Job Family)'[Job Family]), "DynamicValue", 'TOPN (Job Family)'[Job Family], "Name", "Job Family")
        )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would greatly appreciate your continued assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 08:21:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Union-and-iterate/m-p/4385738#M174104</guid>
      <dc:creator>Silvard</dc:creator>
      <dc:date>2025-01-29T08:21:20Z</dc:date>
    </item>
  </channel>
</rss>

