<?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: Help with Replicating excel formula in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-Replicating-excel-formula/m-p/2668909#M37606</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="417252" data-lia-user-login="DummyBIDev" class="lia-mention lia-mention-user"&gt;DummyBIDev&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, Power BI supports us to calculate based on columns. According to your code in excel, I think your data should in same rows from P6 to AS6. If you want to convert your excel formula by Dax, I suggest you to transform your data model.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly add an index column in your table. If you have data from ROW 1 to ROW N, [Index] will help us to determind which row your data should be in data source.&amp;nbsp;Then select [Index] column and &lt;A href="https://docs.microsoft.com/en-us/power-query/unpivot-column" target="_self"&gt;Unpivot&lt;/A&gt; Other Columns.&amp;nbsp;New table should look like as below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _COUNTNA = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "N/A"))
VAR _GREEN = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "Green"))
VAR _Amber = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "Amber"))
VAR _Red = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "Red"))
VAR _MAX = MAXX({_Amber,_Red,_GREEN},[Value]) *1
VAR _SUM1 = _GREEN *1 +_Amber *0.5 + _Red *0
VAR _SUM2 = _GREEN *1 +_Amber *1 + _Red *1
RETURN
IF(AND(_COUNTNA &amp;gt;=1, _MAX = 0),"N/A",IFERROR(DIVIDE(_SUM1,_SUM2),""))&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;&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;</description>
    <pubDate>Fri, 29 Jul 2022 08:04:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-07-29T08:04:50Z</dc:date>
    <item>
      <title>Help with Replicating excel formula</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-Replicating-excel-formula/m-p/2661447#M37547</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New member on here but long time browser.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So a bit of background - i have a few excel documents which feed into a power bi dashboard. The task is now to make it a bit more robust so i have thought about replicating the excel files into Sharepoint Lists which will then feed into the power bi dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to do that, the excel files have alot of formulas which i need to replicate and i understand that these can't be done in Sharepoint but are possible in Power BI (correct me if i am wrong please)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula i have is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=IF(AND(COUNTIF(P6:AS6,"N/A")&amp;gt;=1,COUNTIF(P6:AS6,{"Green","Amber","Red"})*{1,1,1}=0),"N/A",IFERROR(SUM(COUNTIF(P6:AS6,{"Green","Amber","Red"})*{1,0.5,0})/SUM(COUNTIF(P6:AS6,{"Green","Amber","Red"})*{1,1,1}),""))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How easy would it be to replicate this in PowerBI and is my approach for creating sharepoint lists and feeding them into the power bi dashboard a sensible one?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 09:23:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-Replicating-excel-formula/m-p/2661447#M37547</guid>
      <dc:creator>DummyBIDev</dc:creator>
      <dc:date>2022-07-26T09:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Replicating excel formula</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Help-with-Replicating-excel-formula/m-p/2668909#M37606</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="417252" data-lia-user-login="DummyBIDev" class="lia-mention lia-mention-user"&gt;DummyBIDev&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As far as I know, Power BI supports us to calculate based on columns. According to your code in excel, I think your data should in same rows from P6 to AS6. If you want to convert your excel formula by Dax, I suggest you to transform your data model.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly add an index column in your table. If you have data from ROW 1 to ROW N, [Index] will help us to determind which row your data should be in data source.&amp;nbsp;Then select [Index] column and &lt;A href="https://docs.microsoft.com/en-us/power-query/unpivot-column" target="_self"&gt;Unpivot&lt;/A&gt; Other Columns.&amp;nbsp;New table should look like as below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR _COUNTNA = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "N/A"))
VAR _GREEN = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "Green"))
VAR _Amber = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "Amber"))
VAR _Red = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Index] = 6&amp;amp;&amp;amp;'Table'[Value] = "Red"))
VAR _MAX = MAXX({_Amber,_Red,_GREEN},[Value]) *1
VAR _SUM1 = _GREEN *1 +_Amber *0.5 + _Red *0
VAR _SUM2 = _GREEN *1 +_Amber *1 + _Red *1
RETURN
IF(AND(_COUNTNA &amp;gt;=1, _MAX = 0),"N/A",IFERROR(DIVIDE(_SUM1,_SUM2),""))&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;&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;</description>
      <pubDate>Fri, 29 Jul 2022 08:04:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Help-with-Replicating-excel-formula/m-p/2668909#M37606</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-29T08:04:50Z</dc:date>
    </item>
  </channel>
</rss>

