<?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: Reffering to [Value] of GENERATESERIES within Variables in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3404994#M128656</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;av_Transactions_timeperiode =&lt;BR /&gt;VAR start_date =&lt;BR /&gt;COALESCE ( MIN ( 'Merged Data'[Created_Date] ), 0 )&lt;BR /&gt;VAR end_date =&lt;BR /&gt;COALESCE ( MAX ( 'Merged Data'[Created_Date] ), 1 )&lt;BR /&gt;VAR __dates =&lt;BR /&gt;CALENDAR ( start_date, end_date )&lt;BR /&gt;VAR __trans_users =&lt;BR /&gt;GENERATE (&lt;BR /&gt;__dates,&lt;BR /&gt;VAR CurrentDate = [Date]&lt;BR /&gt;VAR Transactions =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;COUNT ( 'Merged Data'[TransactionID] ),&lt;BR /&gt;'Merged Data'[Created_Date] = CurrentDate&lt;BR /&gt;)&lt;BR /&gt;VAR Users =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;DISTINCTCOUNT ( 'Merged Data'[User] ),&lt;BR /&gt;'Merged Data'[Created_Date] = CurrentDate&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;ROW ( "Transactions", Transactions, "Users", Users )&lt;BR /&gt;)&lt;BR /&gt;VAR av_transactions =&lt;BR /&gt;AVERAGEX ( __trans_users, [Transactions] )&lt;BR /&gt;VAR av_users =&lt;BR /&gt;AVERAGEX ( __trans_users, [Users] )&lt;BR /&gt;VAR av_trans_per_user = av_transactions / av_users&lt;BR /&gt;RETURN&lt;BR /&gt;av_trans_per_user&lt;/P&gt;</description>
    <pubDate>Tue, 29 Aug 2023 16:52:06 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2023-08-29T16:52:06Z</dc:date>
    <item>
      <title>Reffering to [Value] of GENERATESERIES within Variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3404742#M128652</link>
      <description>&lt;P&gt;I have a table that contains transactions done by users. Beside the user and the date, the transaction was created on, the table contains several other information like the users team lead, the project and process the transaction was made for, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I now want to create a measure that calculates the average amount of transactions created within a selected periode by users with the same attribute (same project, same team lead, etc.). So the basic calculation would be (average transactions per day) / (average amount of users per day).&lt;BR /&gt;&lt;BR /&gt;This is my approach:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;av_Transactions_timeperiode = 

VAR start_date = IF(ISBLANK(MIN('Merged Data'[Created_Date])),0,MIN('Merged Data'[Created_Date]))
VAR end_date = IF(ISBLANK(MAX('Merged Data'[Created_Date])),1,MAX('Merged Data'[Created_Date]))

VAR __dates = GENERATESERIES(start_date,end_date)

VAR __trans_users = ADDCOLUMNS(__dates,
                                "Transactions",
                                CALCULATE(COUNT('Merged Data'[TransactionID]),'Merged Data'[Created_Date] = [Value]),
                                "Users",
                                CALCULATE(DISTINCTCOUNT('Merged Data'[User]),'Merged Data'[Created_Date] = [Value])
                            )

VAR av_transactions = AVERAGEX(__trans_users,[Transactions])
VAR av_users = AVERAGEX(__trans_users,[Users])

VAR av_trans_per_user = av_transactions/av_users

RETURN av_trans_per_user&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;However this doesn't work. Within the ADDCOLUMNS I can reffer to the [Value] of __dates but as soon as I want to reffer to it within the CALCULATE function it cannot be found. There is no difference when I try to use "__dates[Value]" instead, as __dates is a variable and not a "manifestated" table.&lt;BR /&gt;&lt;BR /&gt;Is there any option I could reffer to the [Value] of __dates within the CALCULATE function? Or is there another approach to calculate the data I want?&lt;BR /&gt;&lt;BR /&gt;If needed: The table "Merged Data" is sliced by a seperate date table that is related via the "Created_Date" column.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 15:13:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3404742#M128652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-29T15:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reffering to [Value] of GENERATESERIES within Variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3404994#M128656</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;av_Transactions_timeperiode =&lt;BR /&gt;VAR start_date =&lt;BR /&gt;COALESCE ( MIN ( 'Merged Data'[Created_Date] ), 0 )&lt;BR /&gt;VAR end_date =&lt;BR /&gt;COALESCE ( MAX ( 'Merged Data'[Created_Date] ), 1 )&lt;BR /&gt;VAR __dates =&lt;BR /&gt;CALENDAR ( start_date, end_date )&lt;BR /&gt;VAR __trans_users =&lt;BR /&gt;GENERATE (&lt;BR /&gt;__dates,&lt;BR /&gt;VAR CurrentDate = [Date]&lt;BR /&gt;VAR Transactions =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;COUNT ( 'Merged Data'[TransactionID] ),&lt;BR /&gt;'Merged Data'[Created_Date] = CurrentDate&lt;BR /&gt;)&lt;BR /&gt;VAR Users =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;DISTINCTCOUNT ( 'Merged Data'[User] ),&lt;BR /&gt;'Merged Data'[Created_Date] = CurrentDate&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;ROW ( "Transactions", Transactions, "Users", Users )&lt;BR /&gt;)&lt;BR /&gt;VAR av_transactions =&lt;BR /&gt;AVERAGEX ( __trans_users, [Transactions] )&lt;BR /&gt;VAR av_users =&lt;BR /&gt;AVERAGEX ( __trans_users, [Users] )&lt;BR /&gt;VAR av_trans_per_user = av_transactions / av_users&lt;BR /&gt;RETURN&lt;BR /&gt;av_trans_per_user&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 16:52:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3404994#M128656</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-08-29T16:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reffering to [Value] of GENERATESERIES within Variables</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3406660#M128719</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this works as intended.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 13:12:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reffering-to-Value-of-GENERATESERIES-within-Variables/m-p/3406660#M128719</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-30T13:12:45Z</dc:date>
    </item>
  </channel>
</rss>

