<?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: Percentage from a calculated measure if less than in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3931844#M152975</link>
    <description>&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight&lt;BR /&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="743923" data-lia-user-login="GTaylor1959" class="lia-mention lia-mention-user"&gt;GTaylor1959&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;Column table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;vwCoronaryCareAdmission table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column_dax =
DATEDIFF(RELATED('column'[DateTimeOfReferral]),'vwCoronaryCareAdmission'[DateTimeOfAdmission],
DAY)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create measure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _count3=
COUNTX(
    FILTER(ALLSELECTED('vwCoronaryCareAdmission'),
    'vwCoronaryCareAdmission'[Column_dax]&amp;lt;=3),[Index])
var _allcount=
COUNTX(
    ALLSELECTED('vwCoronaryCareAdmission'),[Index])
return
DIVIDE(
    _count3,_allcount)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2024 08:30:45 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-20T08:30:45Z</dc:date>
    <item>
      <title>Percentage from a calculated measure if less than</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3922897#M152664</link>
      <description>&lt;P&gt;Can anyone help please as&amp;nbsp; I am new to PowerBI.&amp;nbsp; I have tried many times to create a measure that will give me a percentage if my calculated measure below shows the time to admission from referral is less than 3 days.&amp;nbsp; I would like to show the visual as a percentage on a card.&amp;nbsp; My filter for dates will be within the last 7 days.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The column dax is&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'reporting vwCoronaryCareAdmission'&lt;/SPAN&gt;&lt;SPAN&gt;[DateTimeOfAdmission]&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;RELATED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'column'&lt;/SPAN&gt;&lt;SPAN&gt;[DateTimeOfReferral]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 May 2024 07:54:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3922897#M152664</guid>
      <dc:creator>GTaylor1959</dc:creator>
      <dc:date>2024-05-16T07:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage from a calculated measure if less than</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3923126#M152669</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="743923" data-lia-user-login="GTaylor1959" class="lia-mention lia-mention-user"&gt;GTaylor1959&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not a great deal to go on here, but assuming you want a % that fall within 3 days you can use the DAX below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;% within 3 days = 

VAR _count = COUNTROWS( 'Table' )
VAR _count_in_3days = COUNTROWS(CALCULATETABLE( 'Table', 'Table'[days] &amp;lt;= 3))
VAR calc = DIVIDE( _count_in_3days, _count, 0 )
RETURN
    calc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here I am using CALCULATETABLE to create a virtual table in the measure which stores only the rows where the days are less than or equal to 3. (you can change this filter as required).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you've not used them before VAR creates varaibles that store elements of your calculation for referencing back to later.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A screenshot of this output is below:&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;</description>
      <pubDate>Thu, 16 May 2024 08:51:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3923126#M152669</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-05-16T08:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage from a calculated measure if less than</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3931844#M152975</link>
      <description>&lt;P&gt;Thanks for the reply from &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;, please allow me to provide another insight&lt;BR /&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="743923" data-lia-user-login="GTaylor1959" class="lia-mention lia-mention-user"&gt;GTaylor1959&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;Column table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;vwCoronaryCareAdmission table:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create calculated column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column_dax =
DATEDIFF(RELATED('column'[DateTimeOfReferral]),'vwCoronaryCareAdmission'[DateTimeOfAdmission],
DAY)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2. Create measure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _count3=
COUNTX(
    FILTER(ALLSELECTED('vwCoronaryCareAdmission'),
    'vwCoronaryCareAdmission'[Column_dax]&amp;lt;=3),[Index])
var _allcount=
COUNTX(
    ALLSELECTED('vwCoronaryCareAdmission'),[Index])
return
DIVIDE(
    _count3,_allcount)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 08:30:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentage-from-a-calculated-measure-if-less-than/m-p/3931844#M152975</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-20T08:30:45Z</dc:date>
    </item>
  </channel>
</rss>

