topic Re: How to use Dax to calculate count of good supplier in DAX Commands and Tips
https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389641#M62083
<P>Thank you <LI-USER uid="150936"></LI-USER>!</P>Sat, 12 Mar 2022 03:09:39 GMTDavid_DLLIN2022-03-12T03:09:39ZHow to use Dax to calculate count of good supplier
https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389032#M62052
<P>Hello, <BR /><BR />I have a table as below. What I want is to set up a date slicer, when I choose a date range, Power BI can automatically show the count of good suppliers. This is dynamic, and my initial idea is to create a new measure, but I cannot figure out, wish someone can give me some idea.</P><P> </P><OL><LI>Rate = (sum[A]+sum[B])/(sum[A]+sum[B]+sum[C])</LI><LI>Condition for good supplier is rate >80%. </LI></OL><P>For example, when date is set from <FONT color="#FF0000">2020/9/21 <FONT color="#000000">to</FONT> <FONT color="#0000FF">2021/10/15, <FONT color="#000000">count of good suppliers is 2 (SUPPLIER_NO 4 has rate lower than 80%)</FONT></FONT></FONT></P><P> </P><TABLE><TBODY><TR><TD>SUPPLIER_NO</TD><TD>DATE</TD><TD>A</TD><TD>B</TD><TD>C</TD></TR><TR><TD>2</TD><TD><FONT color="#FF0000">2020/9/21</FONT></TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>2</TD><TD>2020/10/16</TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>2</TD><TD>2020/12/31</TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>2</TD><TD>2021/5/13</TD><TD>0</TD><TD>1</TD><TD>0</TD></TR><TR><TD>2</TD><TD>2021/6/18</TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>2</TD><TD>2021/8/6</TD><TD>0</TD><TD>1</TD><TD>0</TD></TR><TR><TD>2</TD><TD>2021/9/9</TD><TD>0</TD><TD>0</TD><TD>1</TD></TR><TR><TD>2</TD><TD><FONT color="#0000FF">2021/10/15</FONT></TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>3</TD><TD>2020/9/21</TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>3</TD><TD>2020/12/22</TD><TD>0</TD><TD>2</TD><TD>0</TD></TR><TR><TD>3</TD><TD>2021/2/25</TD><TD>1</TD><TD>0</TD><TD>1</TD></TR><TR><TD>3</TD><TD>2021/10/15</TD><TD>0</TD><TD>2</TD><TD>0</TD></TR><TR><TD>4</TD><TD>2020/9/21</TD><TD>2</TD><TD>0</TD><TD>1</TD></TR><TR><TD>4</TD><TD>2020/5/26</TD><TD>3</TD><TD>0</TD><TD>0</TD></TR><TR><TD>4</TD><TD>2021/3/19</TD><TD>2</TD><TD>0</TD><TD>0</TD></TR><TR><TD>4</TD><TD>2021/3/25</TD><TD>0</TD><TD>0</TD><TD>1</TD></TR><TR><TD>4</TD><TD>2021/3/29</TD><TD>0</TD><TD>0</TD><TD>1</TD></TR><TR><TD>4</TD><TD>2021/5/13</TD><TD>0</TD><TD>0</TD><TD>1</TD></TR><TR><TD>4</TD><TD>2021/5/7</TD><TD>0</TD><TD>0</TD><TD>1</TD></TR><TR><TD>4</TD><TD>2021/5/11</TD><TD>1</TD><TD>0</TD><TD>0</TD></TR><TR><TD>4</TD><TD>2021/10/15</TD><TD>1</TD><TD>0</TD><TD>0</TD></TR></TBODY></TABLE><P> </P>Fri, 11 Mar 2022 16:36:12 GMThttps://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389032#M62052David_DLLIN2022-03-11T16:36:12ZRe: How to use Dax to calculate count of good supplier
https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389105#M62057
<P>Hi <LI-USER uid="366308"></LI-USER> </P>
<P>Here's a measure to get good supplier count</P>
<LI-CODE lang="markup">Good Supplier Count =
SUMX(
VALUES('Table'[SUPPLIER_NO]),
VAR _Rate = CALCULATE(
DIVIDE(
SUM('Table'[A]) + SUM('Table'[B]),
SUM('Table'[A]) + SUM('Table'[B]) + SUM('Table'[C]) ) )
RETURN
IF(_Rate > 0.8, 1, 0)
)</LI-CODE>Fri, 11 Mar 2022 17:05:22 GMThttps://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389105#M62057PaulOlding2022-03-11T17:05:22ZRe: How to use Dax to calculate count of good supplier
https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389641#M62083
<P>Thank you <LI-USER uid="150936"></LI-USER>!</P>Sat, 12 Mar 2022 03:09:39 GMThttps://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-use-Dax-to-calculate-count-of-good-supplier/m-p/2389641#M62083David_DLLIN2022-03-12T03:09:39Z