<?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: Dax - Check if one row has the same value for all Columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4666166#M178712</link>
    <description>&lt;P&gt;Hi, probably not the answer you are looking for, but you should realy avoid tables like this in power bi. Power BI is pretty good at handling lots of rows, but 99+ column tables, not such much.&amp;nbsp;&lt;BR /&gt;Try &lt;A href="https://learn.microsoft.com/en-us/power-query/transpose-table" target="_self"&gt;transposing your table&lt;/A&gt; and probably add a dimension for the transposed column names to.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Apr 2025 07:53:57 GMT</pubDate>
    <dc:creator>sjoerdvn</dc:creator>
    <dc:date>2025-04-24T07:53:57Z</dc:date>
    <item>
      <title>Dax - Check if one row has the same value for all Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4664925#M178660</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have the scenario where I have way to many columns to manually type them out in dax yet I want to create a messure to check if any AssetClass either only have the value "Yes" or only have the value "No" for all my columns. Like for example the AssetClass "Bonds" in the table below.&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;AssetClass&lt;/TD&gt;&lt;TD&gt;Column1&lt;/TD&gt;&lt;TD&gt;Column2&lt;/TD&gt;&lt;TD&gt;Column3&lt;/TD&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;Column99&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FX&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;FI&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Bonds&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Yes&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Started creating the code below which would count all the rows where all the columns are "yes" and than compare that to the total amount of rows to see if they match. But I'm not about to manually write out 100 different column names.&lt;BR /&gt;&lt;BR /&gt;Anyone who knows a good way to check if all columns have the same value on the same row without having to manally type out every single coumlmn name?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;AllYes2 =     
VAR _countYes =
    CALCULATE (
        COUNTA( 'Table1'[AssetClass]),
        FILTER ( ALL ( 'Table1' ), 
        'Table1'[Column1] = "YES" || 'Table1'[Column2] = "Yes")
    )
    VAR _countAll =
    CALCULATE ( COUNTA( 'Table1'[AssetClass] ) )
VAR result =
    SWITCH(TRUE(),
    _countYes = _countAll,"","")

    Return
    result&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 12:48:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4664925#M178660</guid>
      <dc:creator>MrMatsson</dc:creator>
      <dc:date>2025-04-23T12:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dax - Check if one row has the same value for all Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4664952#M178661</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1264517" data-lia-user-login="MrMatsson" class="lia-mention lia-mention-user"&gt;MrMatsson&lt;/a&gt;&amp;nbsp;, Try using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dax&lt;BR /&gt;AllYesOrNo = &lt;BR /&gt;VAR ColumnsList = &lt;BR /&gt;UNION(&lt;BR /&gt;SELECTCOLUMNS(ALL('Table1'), "ColumnName", "Column1"),&lt;BR /&gt;SELECTCOLUMNS(ALL('Table1'), "ColumnName", "Column2"),&lt;BR /&gt;SELECTCOLUMNS(ALL('Table1'), "ColumnName", "Column3")&lt;BR /&gt;-- Add more columns as needed&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;VAR CheckYes = &lt;BR /&gt;COUNTROWS(&lt;BR /&gt;FILTER(&lt;BR /&gt;ColumnsList,&lt;BR /&gt;[ColumnName] = "Yes"&lt;BR /&gt;)&lt;BR /&gt;) = COUNTROWS(ColumnsList)&lt;/P&gt;
&lt;P&gt;VAR CheckNo = &lt;BR /&gt;COUNTROWS(&lt;BR /&gt;FILTER(&lt;BR /&gt;ColumnsList,&lt;BR /&gt;[ColumnName] = "No"&lt;BR /&gt;)&lt;BR /&gt;) = COUNTROWS(ColumnsList)&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;IF(CheckYes || CheckNo, "All Yes or All No", "Mixed")&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 13:07:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4664952#M178661</guid>
      <dc:creator>bhanu_gautam</dc:creator>
      <dc:date>2025-04-23T13:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dax - Check if one row has the same value for all Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4664963#M178662</link>
      <description>&lt;P&gt;Thanks for the reply bhanu,&lt;BR /&gt;I'm sure your formula works better than mine but I'm looking for a way to not have to type out all my 99+ column names. Do you know a way to check the value of all columns without listing all column names one by one?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 13:15:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4664963#M178662</guid>
      <dc:creator>MrMatsson</dc:creator>
      <dc:date>2025-04-23T13:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dax - Check if one row has the same value for all Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4666166#M178712</link>
      <description>&lt;P&gt;Hi, probably not the answer you are looking for, but you should realy avoid tables like this in power bi. Power BI is pretty good at handling lots of rows, but 99+ column tables, not such much.&amp;nbsp;&lt;BR /&gt;Try &lt;A href="https://learn.microsoft.com/en-us/power-query/transpose-table" target="_self"&gt;transposing your table&lt;/A&gt; and probably add a dimension for the transposed column names to.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 07:53:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4666166#M178712</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2025-04-24T07:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dax - Check if one row has the same value for all Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4666182#M178713</link>
      <description>&lt;P&gt;Thanks for the reply Sjoerdvn.&lt;BR /&gt;Had the same idea but sadly I have around 50 rows as well. Sigh, looks like I'll just have to admit defeat and type out all the columns one by one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 08:00:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4666182#M178713</guid>
      <dc:creator>MrMatsson</dc:creator>
      <dc:date>2025-04-24T08:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dax - Check if one row has the same value for all Columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4670165#M178877</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1264517" data-lia-user-login="MrMatsson" class="lia-mention lia-mention-user"&gt;MrMatsson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to the Microsoft Fabric Community. Also thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226664" data-lia-user-login="sjoerdvn" class="lia-mention lia-mention-user"&gt;sjoerdvn&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="625922" data-lia-user-login="bhanu_gautam" class="lia-mention lia-mention-user"&gt;bhanu_gautam&lt;/a&gt;&amp;nbsp; for your inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To address your requirement of checking if all columns for an AssetClass have either "Yes" or "No" values without manually listing all column names, here are two approaches:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Unpivot your table in Power Query so that all your columns (e.g., Column1, Column2, ...) become rows. This simplifies checking the values across columns. After unpivoting, you can easily create a DAX measure to check if all values are "Yes" or "No" for each AssetClass.&lt;/LI&gt;
&lt;LI&gt;If unpivoting is not feasible, you can create a helper table with the column names and use DAX to iterate over these columns. For example:&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Create a helper table containing column names:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ColumnsList = DATATABLE("ColumnName", STRING, {("Column1"), ("Column2"), ..., ("Column99")})&lt;/LI-CODE&gt;
&lt;P&gt;Use a DAX measure to check if all values in the columns are "Yes" or "No" for each AssetClass:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AllYesOrNo = 
VAR ColumnsCheck = 
    ADDCOLUMNS(ColumnsList, "ColumnValue", SWITCH(TRUE(), 'Table1'[ColumnName] = "Column1", 'Table1'[Column1], ...))
VAR CheckYes = COUNTROWS(FILTER(ColumnsCheck, [ColumnValue] = "Yes")) = COUNTROWS(ColumnsCheck)
VAR CheckNo = COUNTROWS(FILTER(ColumnsCheck, [ColumnValue] = "No")) = COUNTROWS(ColumnsCheck)
RETURN IF(CheckYes || CheckNo, "All Yes or All No", "Mixed")
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI class="" data-start="1507" data-end="1567"&gt;
&lt;P class="" data-start="1509" data-end="1567"&gt;Unpivoting is the most efficient and dynamic solution. If you need to avoid unpivoting, use a helper table with DAX.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this will resolve your issue, if you need any further assistance, feel free to reach out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;helps, then please give us Kudos and consider&amp;nbsp;Accept it as a solution&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thankyou.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 07:24:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Check-if-one-row-has-the-same-value-for-all-Columns/m-p/4670165#M178877</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-28T07:24:06Z</dc:date>
    </item>
  </channel>
</rss>

