<?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: Find first value above 50% by category using DAX in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3132486#M111509</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your message.&lt;/P&gt;
&lt;P&gt;My solution was for writing calculated measures, not for calculated columns.&lt;/P&gt;
&lt;P&gt;I am not 100% sure, but it might need to be written in a different way based on how your data model looks like.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2023 04:17:36 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2023-03-15T04:17:36Z</dc:date>
    <item>
      <title>Find first value above 50% by category using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3130798#M111404</link>
      <description>&lt;P&gt;Dear DAX Brains Trust!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write a column in DAX that returns the first value above 50% within a categorised cumulative column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For context I've got a big dataset off all the postcodes around Australia and with each postcode comes an income category, 14 to be precise, thanks to the Australia Bureau of Statistics (ABS).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been through an arduous but insightful process via power query in which I have organised them by creating a list.generate function which has returned each income category within the postcode with cumulative running total of income % - Thanks to&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="322417" data-lia-user-login="RickdeGroot" class="lia-mention lia-mention-user"&gt;RickdeGroot&lt;/a&gt;&amp;nbsp;(BI Gorrilla) and possibly the GOAT of M code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've now got my data how I want it, and as a final step would like to create a measure or column. That returns the first value over 50% within the cumulative running for each postcode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit stumped at how I achieve this, I've tried RANKX &amp;amp; TOPN but with very little success.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will post a screenshot of the data and attempted DAX code tomorrow. Any advice beforehand would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 13:17:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3130798#M111404</guid>
      <dc:creator>dschin02</dc:creator>
      <dc:date>2023-03-14T13:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find first value above 50% by category using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3131576#M111451</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;I tried to create a sample pbix file like below, and I hope the below can provide some ideas on how to create a solution for your datamodel.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Income: = 
SUM( Data[Income] )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Income cumulative ratio: = 
VAR _runningtotal =
    CALCULATE (
        [Income:],
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ADDCOLUMNS (
                SUMMARIZE ( ALL ( Data ), PostCode[PostCode], Data[Customer] ),
                "@income", [Income:]
            ),
            ORDERBY ( [@income], ASC ),
            KEEP,
            PARTITIONBY ( PostCode[PostCode] )
        )
    )
VAR _allincomebypostcode =
    CALCULATE ( [Income:], ALL ( Data[Customer] ) )
VAR _cumulativepercentage =
    DIVIDE ( _runningtotal, _allincomebypostcode )
RETURN
    _cumulativepercentage&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;First value above 50%: = 
IF (
    [Income cumulative ratio:]
        = MINX (
            FILTER (
                ADDCOLUMNS ( ALL ( Data[Customer] ), "@ratio", [Income cumulative ratio:] ),
                [@ratio] &amp;gt; 0.5
            ),
            [@ratio]
        ),
    [Income:]
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 17:34:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3131576#M111451</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-03-14T17:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Find first value above 50% by category using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3132331#M111496</link>
      <description>&lt;P&gt;Thanks for this, It's very helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your code seems to work and it is what I am looking for. However when I run it it returns all atribute values above 50%. Whilst I am only seeking the first value above 50% categorised by postcode. See screenshot below. I've underlined the postcode category types and the value I want it to return.&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 02:15:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3132331#M111496</guid>
      <dc:creator>dschin02</dc:creator>
      <dc:date>2023-03-15T02:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Find first value above 50% by category using DAX</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3132486#M111509</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you for your message.&lt;/P&gt;
&lt;P&gt;My solution was for writing calculated measures, not for calculated columns.&lt;/P&gt;
&lt;P&gt;I am not 100% sure, but it might need to be written in a different way based on how your data model looks like.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 04:17:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-first-value-above-50-by-category-using-DAX/m-p/3132486#M111509</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-03-15T04:17:36Z</dc:date>
    </item>
  </channel>
</rss>

