<?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: Calculation error in a measure related to USERPRINCIPALNAME function in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056579#M105454</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="10256" data-lia-user-login="jflipse" class="lia-mention lia-mention-user"&gt;jflipse&lt;/a&gt; , seem like you are creating goal as column not meausre &lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 02:12:47 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2023-02-02T02:12:47Z</dc:date>
    <item>
      <title>Calculation error in a measure related to USERPRINCIPALNAME function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056366#M105444</link>
      <description>&lt;P&gt;I am having issues with a calculation based on data originating from USERPRINCIPLENAME.&amp;nbsp; I created two measures, one to capture the user's info and the other to query a table that tells the type of the user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure 1:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RLS User = USERPRINCIPALNAME()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure 2:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RLS RoleType = &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;// Get the role type for the RLS user from the ORG query&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;VAR _RLSUser = [RLS User]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;LOOKUPVALUE(&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ORG[ROLETYPE],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;ORG[SOFTWARE_UPDT_USR],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;_RLSUser&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Both measures were successful in their tasks, so I know the user's name and their role type, "Type1" and "Type2".&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then want to perform math in another meaure depending on the type returned.&amp;nbsp; If Type1 then I want to divide a number by 1, but if Type2 then I want to divide by 2.&amp;nbsp; Something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Goal =&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;VAR _Denominator = IF([RLS RoleType] = "Type1",1,2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;RETURN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Calculate (SUM(Revenue)/_Denominator,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;'Product'[Product Name] = "Red"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I try this, I recieve the message that, "CUSTOMDATA, USERNAME, USERCULTURE and USERPRINCIPLENAME functions are not supported in calculated tables/columns.&amp;nbsp; These functions may only be used in Measures or in AllowedRowsExpression."&amp;nbsp; This is unexpected, since all my calculations are done within measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried moving the determination of the denominator into it's own seperate measure thinking that perhaps having the calculation in a seperate measure from the IF logic would make a difference, but it did not.&amp;nbsp; I tried taking the value of the denominator and changing it to a string and then back to a number, but that resulted in the same error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on how one might perform such a calulation without error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 23:34:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056366#M105444</guid>
      <dc:creator>jflipse</dc:creator>
      <dc:date>2023-02-01T23:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation error in a measure related to USERPRINCIPALNAME function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056579#M105454</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="10256" data-lia-user-login="jflipse" class="lia-mention lia-mention-user"&gt;jflipse&lt;/a&gt; , seem like you are creating goal as column not meausre &lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 02:12:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056579#M105454</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-02-02T02:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation error in a measure related to USERPRINCIPALNAME function</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056800#M105474</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;, in my model I've confirmed I am creating Goal as a measure.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 04:07:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-error-in-a-measure-related-to-USERPRINCIPALNAME/m-p/3056800#M105474</guid>
      <dc:creator>jflipse</dc:creator>
      <dc:date>2023-02-02T04:07:30Z</dc:date>
    </item>
  </channel>
</rss>

