<?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 Counting Several date occurrence as one to get correct daily average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2535112#M71228</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean that you want to count&amp;nbsp;&lt;SPAN&gt;10k times repeating Access Request ID on 2022/02/24 to only once?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My Sample:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try this code to create measure or calcualted column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Daily Average (Calculated Column) =
CALCULATE (
    DISTINCTCOUNT ( 'Fact-Daily Access Request'[Access Request ID] ),
    ALLEXCEPT (
        'Fact-Daily Access Request',
        'Fact-Daily Access Request'[Request Date]
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Daily Average (Measure) =
CALCULATE (
    DISTINCTCOUNT ( 'Fact-Daily Access Request'[Access Request ID] ),
    ALLEXCEPT (
        'Fact-Daily Access Request',
        'Fact-Daily Access Request'[Request Date]
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&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;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2022 06:40:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-05-24T06:40:02Z</dc:date>
    <item>
      <title>Dax Counting Several date occurrence as one to get correct daily average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2527768#M70759</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello my friend thank You in advance for Your help.&lt;/P&gt;&lt;P&gt;I am looking to get a daily request average. The issue is that some date are occuring more than once hence I am not able to get a perfect count. let's say per example for on 2/24 I received 10k request but each occurence a different time. Now I'm trying to count this occuence as one for 2/24 having 10k request and only one date which is 2/24.&lt;/P&gt;&lt;P&gt;this the data sample&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the DAX I wrote&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daily Average = COUNT('Fact-Daily Access Request'[Access Request ID])/DISTINCTCOUNT('Fact-Daily Access Request'[Request Date]).&lt;/P&gt;&lt;P&gt;But I am not able to count date several occurence as one. I'm ok with the request ID to be counted several time but the date needs to only be counted once.&lt;/P&gt;&lt;P&gt;Thank You my friend&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 22:31:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2527768#M70759</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-19T22:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dax Counting Several date occurrence as one to get correct daily average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2527891#M70764</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;Can you add a Date Table? Modeling&amp;gt; New Table then this code(Below). Afterwhich Mark Date field as Date Table and connect to your other fact table on Date fields.&lt;/P&gt;&lt;P&gt;Measure to &lt;STRONG&gt;Total Requests&lt;/STRONG&gt; = SUM(&lt;SPAN&gt;'Fact-Daily Access Request'[Access Request ID])&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Daily Requests&lt;/STRONG&gt; = AVERAGEX(Values(Dates[Date]), [Total Requests]))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It would be good to have dimension table for AccessRequest_ID that is unique and has relaionship with fact table. You can then sort by RequestorID.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I hope this helps! Thanks..&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Daily Requests II(no weekends included) =&amp;nbsp;&lt;BR /&gt;&amp;nbsp; var weekdaytable = Filter(Dates, Dates[DayinWeek] &amp;lt;&amp;gt; 7 &amp;amp;&amp;amp; Dates[DayinWeek] &amp;lt;&amp;gt; 1)&lt;BR /&gt;return&lt;BR /&gt;AVERAGEX(Weekdaytable[Total Requests])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dates =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Specify a start date and end date&lt;/P&gt;&lt;P&gt;VAR StartDate = Date(2021,1,1)&lt;/P&gt;&lt;P&gt;VAR EndDate = Today() + 243&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR FiscalMonthEnd = 12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Generate a base table of dates&lt;/P&gt;&lt;P&gt;VAR BaseTable = Calendar(StartDate, EndDate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Add the Year for each individual date&lt;/P&gt;&lt;P&gt;VAR Years = ADDCOLUMNS(BaseTable,"Year",YEAR([Date]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Add the calendar month and other month related data for each date&lt;/P&gt;&lt;P&gt;VAR Months = ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Years,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Month",MONTH([Date]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Year and Month Number",FORMAT([Date],"YYYY-MM"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Year and Month Name",FORMAT([Date],"YYYY-MMM"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Fiscal Year", IF( FiscalMonthEnd = 12, YEAR([Date]), IF( MONTH([DATE]) &amp;lt;= FiscalMonthEnd, YEAR([DATE])-1, YEAR([Date]))),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Fiscal Month", IF( FiscalMonthEnd = 12, MONTH([Date]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF( MONTH([Date]) &amp;lt;= FiscalMonthEnd, FiscalMonthEnd + MONTH([Date]), MONTH([Date]) - FiscalMonthEnd))&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Add the Quarter and other quarter related data for each date&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR Quarters = ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Months,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Quarter",ROUNDUP(MONTH([Date])/3,0),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Year and Quarter",[Year] &amp;amp; "-Q" &amp;amp; ROUNDUP(MONTH([Date])/3,0))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Add the Day and other day related data for each date&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR Days = ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Quarters,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Day",DAY([Date]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;"Day Name",FORMAT([Date],"DDDD"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Day Of Week",WEEKDAY([Date]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Day Of Year", DATEDIFF (DATE(YEAR([Date]),1,1), [Date], DAY) + 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Add the Week (assuming each week starts on a Sunday) and other week related data for each date&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR Weeks = ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Days,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Week Of Month (Sunday)",INT((DAY([Date])-1)/7)+1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Week of Year (Sunday)",WEEKNUM([Date],1),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Year and Week (Sunday)",[Year] &amp;amp; "-W" &amp;amp; WEEKNUM([Date],1))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Add an 'Is Working Day' column which will be true for all days but Saturday and Sunday.&lt;/P&gt;&lt;P&gt;var WorkingDays = ADDCOLUMNS(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Weeks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Is Working Day", NOT WEEKDAY( [Date] ) IN {1,7})&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RETURN WorkingDays&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 00:52:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2527891#M70764</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-20T00:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dax Counting Several date occurrence as one to get correct daily average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2528086#M70781</link>
      <description>&lt;P&gt;Thanks You so much for Your input.&amp;nbsp; I actually have Calendar table from another dashbaord, so I just copy and paste to this dashabord. I have the date column to make a connection to my fact table through Request Date column&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However using this Dax&amp;nbsp;&lt;STRONG&gt;Daily Requests&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;= AVERAGEX(Values(Dates[Date]), [Total Requests])) or&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Total Requests&lt;/STRONG&gt;&amp;nbsp;= SUM('Fact-Daily Access Request'[Access Request ID]) doesn't give me accurate number.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 02:57:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2528086#M70781</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-20T02:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dax Counting Several date occurrence as one to get correct daily average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2535112#M71228</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean that you want to count&amp;nbsp;&lt;SPAN&gt;10k times repeating Access Request ID on 2022/02/24 to only once?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My Sample:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try this code to create measure or calcualted column.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Daily Average (Calculated Column) =
CALCULATE (
    DISTINCTCOUNT ( 'Fact-Daily Access Request'[Access Request ID] ),
    ALLEXCEPT (
        'Fact-Daily Access Request',
        'Fact-Daily Access Request'[Request Date]
    )
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Daily Average (Measure) =
CALCULATE (
    DISTINCTCOUNT ( 'Fact-Daily Access Request'[Access Request ID] ),
    ALLEXCEPT (
        'Fact-Daily Access Request',
        'Fact-Daily Access Request'[Request Date]
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&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;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 06:40:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2535112#M71228</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-24T06:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dax Counting Several date occurrence as one to get correct daily average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2536937#M71330</link>
      <description>&lt;P&gt;Thank You for Your input! In fact I am trying to first get the average daily count. In this example I'm trying to find what's the total of Access request ID&amp;nbsp; for the Request date 2022-02-04, here the request date is being 'Duplicate' because they all come at different time during the day.&lt;BR /&gt;Then based on the total request I will need to find the over all daily average.&lt;BR /&gt;&lt;BR /&gt;Thank You my friend.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 16:24:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2536937#M71330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-24T16:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dax Counting Several date occurrence as one to get correct daily average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2537022#M71337</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;I understand, using last file suppplied your calc ol can be:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Daily Requests = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Fact-Daily Access Request'&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Fact-Daily Access Request'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Fact-Daily Access Request'[Access Request ID]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Daily Requests(M) = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Fact-Daily Access Request'&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Fact-Daily Access Request'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'Fact-Daily Access Request'[Access Request ID]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;Answer = 15. Does this solve? Thanks..&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 24 May 2022 17:03:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-Counting-Several-date-occurrence-as-one-to-get-correct-daily/m-p/2537022#M71337</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-24T17:03:47Z</dc:date>
    </item>
  </channel>
</rss>

