<?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: Blank total from measure with HASONEVALUE in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4262144#M168928</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="397186" data-lia-user-login="vsp_p1" class="lia-mention lia-mention-user"&gt;vsp_p1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use Distinct Count instead&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Fact - Payments'&lt;/SPAN&gt;&lt;SPAN&gt;[Currency_Key]&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;The customer has multiple copies of the same Currency Key so HasOneValue won't return TRUE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 29 Oct 2024 11:14:56 GMT</pubDate>
    <dc:creator>SamWiseOwl</dc:creator>
    <dc:date>2024-10-29T11:14:56Z</dc:date>
    <item>
      <title>Blank total from measure with HASONEVALUE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4262117#M168926</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;I have a report that shows customers' balances. I want to show the total when only one currency is in the context. I'm trying to achieve this by using the HASONEVALUE() function, but the balance is always blank. What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the sample report -&amp;nbsp;&lt;A title="Blank Total Problem" href="https://drive.google.com/file/d/124WPcxeaB9Uu-E34_H9BhkMeE7nbGnaQ/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/124WPcxeaB9Uu-E34_H9BhkMeE7nbGnaQ/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards, VSP&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2024 10:51:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4262117#M168926</guid>
      <dc:creator>vsp_p1</dc:creator>
      <dc:date>2024-10-29T10:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Blank total from measure with HASONEVALUE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4262144#M168928</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="397186" data-lia-user-login="vsp_p1" class="lia-mention lia-mention-user"&gt;vsp_p1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use Distinct Count instead&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Fact - Payments'&lt;/SPAN&gt;&lt;SPAN&gt;[Currency_Key]&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;The customer has multiple copies of the same Currency Key so HasOneValue won't return TRUE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 29 Oct 2024 11:14:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4262144#M168928</guid>
      <dc:creator>SamWiseOwl</dc:creator>
      <dc:date>2024-10-29T11:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Blank total from measure with HASONEVALUE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4263159#M168973</link>
      <description>&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Thanks for the reply from&amp;nbsp;SamWiseOwl&amp;nbsp; please allow me to provide another insight:&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="397186" data-lia-user-login="vsp_p1" class="lia-mention lia-mention-user"&gt;vsp_p1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt;" lang="zh-CN"&gt;Could you please let us know if&amp;nbsp;SamWiseOwl's&amp;nbsp;response resolved your issue? If it did, kindly accept it as the solution.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;Due to our security protocols, I am unable to access the link you provided directly. As a result, I cannot ascertain the root cause of your issue or whether it has been resolved. Could you please provide more context or specific details? This would enable me to assist you more effectively!&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;When uploading a file, please be careful to delete sensitive information.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;For questions about uploading data, you can try the following links:&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;&lt;SPAN&gt;How to provide sample data in the Power BI Forum - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin-top: 0pt; margin-bottom: 6pt;"&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-upload-PBI-in-Community/m-p/1672886" target="_blank"&gt;&lt;SPAN&gt;Solved: How to upload PBI in Community - Microsoft Fabric Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;" lang="zh-CN"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: Arial; font-size: 12.0pt; color: black;"&gt;Leroy Lu&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 03:09:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4263159#M168973</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-30T03:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Blank total from measure with HASONEVALUE</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4265296#M169037</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="780072" data-lia-user-login="SamWiseOwl" class="lia-mention lia-mention-user"&gt;SamWiseOwl&lt;/a&gt;&amp;nbsp;for your response. The solution didn't work for me, but I got some inspiration from it and worked further on my DAX to find a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HASONEVALUE filters down to one distinct value (&lt;A href="https://dax.guide/hasonevalue/" target="_blank" rel="noopener"&gt;HASONEVALUE - DAX Guide&lt;/A&gt;), so having multiple lines was not the problem. The problem was I was getting 0 for some value, which I conditionally made blank at the end. The DAX was returning lines with different currencies, some with 0 balance (or that's how I understand it). So, I had to first remove those lines with balance = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anonymous&lt;/a&gt;,&amp;nbsp;anyone with the link can access the file, so I'm not sure why you can't &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; But my problem is (was) that my DAX made the total BLANK when I used HASONEVALUE on currency. It looked like there was only one currency, but there were more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX that gave me what I wanted, which I'm using now in the report. If you guys can suggest improvements to it, that would be great. (Please note that the measures used here come from on-prem SSAS cube).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Balance - Invoice = 
VAR _CurrencyCount =
    SWITCH
    (
        MAX('Due Filter'[Due]),
        "All",          COUNTX
                        (
                            FILTER
                            (
                                SUMMARIZE('Fact - Payment', 'Fact - Payment'[Currency_Key], "Balance", [Invoice Balance]),
                                [Balance] &amp;lt;&amp;gt; 0
                            ),
                            [Currency_Key]
                        ),
        "Today",        COUNTX
                        (
                            FILTER
                            (
                                CALCULATETABLE
                                (
                                    SUMMARIZE('Fact - Payment', 'Fact - Payment'[Currency_Key], "Balance", [Invoice Balance]),
                                    FILTER('Date - Due', 'Date - Due'[Due Date] = TODAY())
                                ),
                                [Balance] &amp;lt;&amp;gt; 0
                            ),
                            [Currency_Key]
                        ),
        "In 7 days",    COUNTX
                        (
                            FILTER
                            (
                                CALCULATETABLE
                                (
                                    SUMMARIZE('Fact - Payment', 'Fact - Payment'[Currency_Key], "Balance", [Invoice Balance]),
                                    FILTER('Date - Due', 'Date - Due'[Due Date] &amp;gt;= TODAY() &amp;amp;&amp;amp; 'Date - Due'[Due Date] &amp;lt;= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) +  7))
                                ),
                                [Balance] &amp;lt;&amp;gt; 0
                            ),
                            [Currency_Key]
                        ),
        "In 14 days",   COUNTX
                        (
                            FILTER
                            (
                                CALCULATETABLE
                                (
                                    SUMMARIZE('Fact - Payment', 'Fact - Payment'[Currency_Key], "Balance", [Invoice Balance]),
                                    FILTER('Date - Due', 'Date - Due'[Due Date] &amp;gt;= TODAY() &amp;amp;&amp;amp; 'Date - Due'[Due Date] &amp;lt;= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) + 14))
                                ),
                                [Balance] &amp;lt;&amp;gt; 0
                            ),
                            [Currency_Key]
                        ),
        "In 30 days",   COUNTX
                        (
                            FILTER
                            (
                                CALCULATETABLE
                                (
                                    SUMMARIZE('Fact - Payment', 'Fact - Payment'[Currency_Key], "Balance", [Invoice Balance]),
                                    FILTER('Date - Due', 'Date - Due'[Due Date] &amp;gt;= TODAY() &amp;amp;&amp;amp; 'Date - Due'[Due Date] &amp;lt;= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) + 30))
                                ),
                                [Balance] &amp;lt;&amp;gt; 0
                            ),
                            [Currency_Key]
                        ),
        "Overdue",      COUNTX
                        (
                            FILTER
                            (
                                CALCULATETABLE
                                (
                                    SUMMARIZE('Fact - Payment', 'Fact - Payment'[Currency_Key], "Balance", [Invoice Balance]),
                                    FILTER('Date - Due', 'Date - Due'[Due Date] &amp;lt; TODAY())
                                ),
                                [Balance] &amp;lt;&amp;gt; 0
                            ),
                            [Currency_Key]
                        )
    )

VAR _InvBal =
    SWITCH
    (
        MAX('Due Filter'[Due]),
        "All"       , [Invoice Balance],
        "Today"     , CALCULATE([Invoice Balance], FILTER('Date - Due', 'Date - Due'[Due Date] = TODAY())),
        "In 7 days" , CALCULATE([Invoice Balance], FILTER('Date - Due', 'Date - Due'[Due Date] &amp;gt;= TODAY() &amp;amp;&amp;amp; 'Date - Due'[Due Date] &amp;lt;= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) +  7))),
        "In 14 days", CALCULATE([Invoice Balance], FILTER('Date - Due', 'Date - Due'[Due Date] &amp;gt;= TODAY() &amp;amp;&amp;amp; 'Date - Due'[Due Date] &amp;lt;= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) + 14))),
        "In 30 days", CALCULATE([Invoice Balance], FILTER('Date - Due', 'Date - Due'[Due Date] &amp;gt;= TODAY() &amp;amp;&amp;amp; 'Date - Due'[Due Date] &amp;lt;= DATE(YEAR(TODAY()), MONTH(TODAY()), DAY(TODAY()) + 30))),
        "Overdue"   , CALCULATE([Invoice Balance], FILTER('Date - Due', 'Date - Due'[Due Date] &amp;lt; TODAY()))
    )

RETURN
IF
(
    HASONEVALUE('Fact - Payment'[Currency_Key]),
    IF(_InvBal = 0, BLANK(), _InvBal),
    IF
    (
        _CurrencyCount = 1,
        IF(_InvBal = 0, BLANK(), _InvBal),
        BLANK()
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards, VSP&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 09:15:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Blank-total-from-measure-with-HASONEVALUE/m-p/4265296#M169037</guid>
      <dc:creator>vsp_p1</dc:creator>
      <dc:date>2024-10-31T09:15:04Z</dc:date>
    </item>
  </channel>
</rss>

