<?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: Selected Value dax Query in Desktop</title>
    <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833311#M1237751</link>
    <description>&lt;P&gt;You're better off doing this in M that in DAX.&amp;nbsp; Below is the updated DAX calculated table formula but this returns the wrong order and won't change even if created as a new&amp;nbsp; table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable_ = 
VAR __TYPE =
    DISTINCT ( OriginalTable[Type] )
VAR __TYPE2 =
    DISTINCT (
        SELECTCOLUMNS (
            OriginalTable,
            "Type", [Type],
            "Carrier", [Type],
            "Sort", [Index]
        )
    )
VAR __CROSSJOINED =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN (
                __TYPE,
                SELECTCOLUMNS (
                    OriginalTable,
                    "Type2", [Type],
                    "Carrier", [Carrier],
                    "Sort", [Index]
                )
            ),
            [Type] &amp;lt;&amp;gt; [Type2]
        ),
        "Type", [Type],
        "Sort", [Sort],
        "Carrier", [Carrier]
    )
VAR __LETTER_CARRIER =
    ADDCOLUMNS ( __TYPE, "Carrier", [Type] )
RETURN
    UNION ( __CROSSJOINED, __TYPE2 )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the M code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXJOLCrKTC1SMFSK1YlWckISMQKLOCOJGINFXJBETMAirkgipmARNyQRM6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Type = _t, Carrier = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}, {"Carrier", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Table from Previous Step" = Table.AddColumn(#"Added Index", "Previous Step", each #"Added Index"),
    #"Expanded Previous Step" = Table.ExpandTableColumn(#"Table from Previous Step", "Previous Step", {"Type", "Carrier", "Index"}, {"Previous Step.Type", "Previous Step.Carrier", "Previous Step.Index"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Previous Step", each [Previous Step.Type] &amp;lt;&amp;gt; [Type]),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Type", "Previous Step.Carrier", "Previous Step.Index"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Previous Step.Index", "Index"}}),
    #"Appended Added Index to the Prev Step" = Table.Combine({#"Added Index", #"Renamed Columns"}),
    #"Removed Columns" = Table.RemoveColumns(#"Appended Added Index to the Prev Step",{"Carrier"}),
    #"Added Custom" = Table.AddColumn(#"Removed Columns", "Carrier", each if [Previous Step.Carrier] = null then [Type] else [Previous Step.Carrier]),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Previous Step.Carrier"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns1",{"Type", "Carrier", "Index"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Reordered Columns",{{"Carrier", type text}}),
    #"Renamed Columns1" = Table.RenameColumns(#"Changed Type1",{{"Index", "Sort"}})
in
    #"Renamed Columns1"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2024 09:24:22 GMT</pubDate>
    <dc:creator>danextian</dc:creator>
    <dc:date>2024-04-12T09:24:22Z</dc:date>
    <item>
      <title>Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3829317#M1237015</link>
      <description>&lt;P&gt;I have this data but not sure on how to do the dax on this.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thank you on whoever can help me.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 05:32:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3829317#M1237015</guid>
      <dc:creator>JuradoKevin14</dc:creator>
      <dc:date>2024-04-11T05:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3829996#M1237085</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="684335" data-lia-user-login="JuradoKevin14" class="lia-mention lia-mention-user"&gt;JuradoKevin14&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SELECTEDVALUE won't work. You need to make the list physically appear in the model for every value in Type.&amp;nbsp; Assuming that the Carrier value is to be replaced by Type value, use this sample DAX calculated table.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable =
VAR __TYPE =
    DISTINCT ( OriginalTable[Type] )
VAR __CROSSJOINED =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN (
                __TYPE,
                SELECTCOLUMNS (
                    OriginalTable,
                    "Type2", OriginalTable[Type],
                    "Carrier", OriginalTable[Carrier]
                )
            ),
            [Type] &amp;lt;&amp;gt; [Type2]
        ),
        "Type", [Type],
        "Carrier", [Carrier]
    )
VAR __LETTER_CARRIER =
    ADDCOLUMNS ( __TYPE, "Carrier", [Type] )
RETURN
    UNION ( __LETTER_CARRIER, __CROSSJOINED )
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 08:05:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3829996#M1237085</guid>
      <dc:creator>danextian</dc:creator>
      <dc:date>2024-04-11T08:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3831199#M1237267</link>
      <description>&lt;P&gt;Hi sir thank you got it. but i am fixing the sort so that it would be in ascending order. but I cant seem to put it in the filter page?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 14:18:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3831199#M1237267</guid>
      <dc:creator>JuradoKevin14</dc:creator>
      <dc:date>2024-04-11T14:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3831305#M1237301</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="684335" data-lia-user-login="JuradoKevin14" class="lia-mention lia-mention-user"&gt;JuradoKevin14&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;select the Type column and go to columntools and click on sort option, here you need to select Sort column. we basically specifying to use Sort column to sort Type column with this approach.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#993300"&gt;Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 15:01:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3831305#M1237301</guid>
      <dc:creator>johnbasha33</dc:creator>
      <dc:date>2024-04-11T15:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3831319#M1237311</link>
      <description>&lt;P&gt;Modidfy the calculated table formula to below to add a sort column. All Carrier values will have a blank sort while the rest will have 1. &lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable =
VAR __TYPE =
    DISTINCT ( OriginalTable[Type] )
VAR __CROSSJOINED =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN (
                __TYPE,
                SELECTCOLUMNS (
                    OriginalTable,
                    "Type2", OriginalTable[Type],
                    "Carrier", OriginalTable[Carrier]
                )
            ),
            [Type] &amp;lt;&amp;gt; [Type2]
        ),
        "Type", [Type],
        "Carrier", [Carrier],
        "Sort", 1
    )
VAR __LETTER_CARRIER =
    ADDCOLUMNS ( __TYPE, "Carrier", [Type], "Sort", BLANK () )
RETURN
    UNION ( __LETTER_CARRIER, __CROSSJOINED )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 15:14:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3831319#M1237311</guid>
      <dc:creator>danextian</dc:creator>
      <dc:date>2024-04-11T15:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3832374#M1237597</link>
      <description>&lt;P&gt;The sorting should be the same as the corresponding Carrier.&lt;/P&gt;&lt;P&gt;The shorting should be like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 03:08:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3832374#M1237597</guid>
      <dc:creator>JuradoKevin14</dc:creator>
      <dc:date>2024-04-12T03:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833311#M1237751</link>
      <description>&lt;P&gt;You're better off doing this in M that in DAX.&amp;nbsp; Below is the updated DAX calculated table formula but this returns the wrong order and won't change even if created as a new&amp;nbsp; table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NewTable_ = 
VAR __TYPE =
    DISTINCT ( OriginalTable[Type] )
VAR __TYPE2 =
    DISTINCT (
        SELECTCOLUMNS (
            OriginalTable,
            "Type", [Type],
            "Carrier", [Type],
            "Sort", [Index]
        )
    )
VAR __CROSSJOINED =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN (
                __TYPE,
                SELECTCOLUMNS (
                    OriginalTable,
                    "Type2", [Type],
                    "Carrier", [Carrier],
                    "Sort", [Index]
                )
            ),
            [Type] &amp;lt;&amp;gt; [Type2]
        ),
        "Type", [Type],
        "Sort", [Sort],
        "Carrier", [Carrier]
    )
VAR __LETTER_CARRIER =
    ADDCOLUMNS ( __TYPE, "Carrier", [Type] )
RETURN
    UNION ( __CROSSJOINED, __TYPE2 )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the M code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUXJOLCrKTC1SMFSK1YlWckISMQKLOCOJGINFXJBETMAirkgipmARNyQRM6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Type = _t, Carrier = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Type", type text}, {"Carrier", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Table from Previous Step" = Table.AddColumn(#"Added Index", "Previous Step", each #"Added Index"),
    #"Expanded Previous Step" = Table.ExpandTableColumn(#"Table from Previous Step", "Previous Step", {"Type", "Carrier", "Index"}, {"Previous Step.Type", "Previous Step.Carrier", "Previous Step.Index"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Previous Step", each [Previous Step.Type] &amp;lt;&amp;gt; [Type]),
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Type", "Previous Step.Carrier", "Previous Step.Index"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Previous Step.Index", "Index"}}),
    #"Appended Added Index to the Prev Step" = Table.Combine({#"Added Index", #"Renamed Columns"}),
    #"Removed Columns" = Table.RemoveColumns(#"Appended Added Index to the Prev Step",{"Carrier"}),
    #"Added Custom" = Table.AddColumn(#"Removed Columns", "Carrier", each if [Previous Step.Carrier] = null then [Type] else [Previous Step.Carrier]),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom",{"Previous Step.Carrier"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns1",{"Type", "Carrier", "Index"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Reordered Columns",{{"Carrier", type text}}),
    #"Renamed Columns1" = Table.RenameColumns(#"Changed Type1",{{"Index", "Sort"}})
in
    #"Renamed Columns1"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 09:24:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833311#M1237751</guid>
      <dc:creator>danextian</dc:creator>
      <dc:date>2024-04-12T09:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833441#M1237777</link>
      <description>&lt;P&gt;I think i am havign trouble using this concept to incorporate to my existing data model. Is it possible to use it as a measure instead?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 10:04:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833441#M1237777</guid>
      <dc:creator>JuradoKevin14</dc:creator>
      <dc:date>2024-04-12T10:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833586#M1237796</link>
      <description>&lt;P&gt;A measure doesn't create rows so you won't be able to have those tabular lists. If the calculated table on your end, doesnt&amp;nbsp; give you the correct order, you can just create two extra columns to kind of select the should be column values.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sort2 = 
IFERROR ( VALUE ( NewTable[Sort] ), VALUE ( NewTable[Carrier] ) )

Carrier2 = 
IF (
    NewTable[Sort] = NewTable[Type],
    NewTable[Type],
    NewTable[Carrier]
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 11:04:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3833586#M1237796</guid>
      <dc:creator>danextian</dc:creator>
      <dc:date>2024-04-12T11:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Selected Value dax Query</title>
      <link>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3834195#M1237900</link>
      <description>&lt;P&gt;The problem is i am using this table as dim to be connected to a fact table. so the relationship is many to many.. and also only A has data when it is connected becasue in the fact table the type is only shown. not the corresponding column which is the carrier. For example :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 13:31:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Desktop/Selected-Value-dax-Query/m-p/3834195#M1237900</guid>
      <dc:creator>JuradoKevin14</dc:creator>
      <dc:date>2024-04-12T13:31:55Z</dc:date>
    </item>
  </channel>
</rss>

