Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
summer18
Helper III
Helper III

Sum of Distinct Values over Total Distinct by Category

Hi,

I need assistance on the formula for computing % of new products over total.  I could not achieve the desired output.

Formula should be New Product Count / Total by Region. 

Eg.  for Asia and Enterprise = 7 / 113 (total for Asia) = 6.19%

 

wrongpercent01.png

Correct %:

wrongpercent02.png

 

The formulas I used:

1) Count of NEW Products = 

CALCULATE(

                  DISTINCTCOUNT(DATA[ProductID]),

                  DATA[Status] IN {"New"})

2) Total Count of Products =
SUMX(
          KEEPFILTERS(VALUES(DATA[Region])),
          CALCULATE(DISTINCTCOUNT(DATA[ProductID]))
)

3)  % New Products = IFERROR([Count of NEW Products]/[Total Count of Products],0)

 

Attaching the links for the pbix and sample data with computation.

https://drive.google.com/drive/folders/1d1ivWVWhnNzfcUGdseXiTY71pldhct5M?usp=sharing

 

Thanks in advance for your help.

 

Regards,

Summer

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @summer18 ,

 

Try this:

% New Products =
IFERROR (
    [Count of NEW Products]
        / CALCULATE ( [Total Count of Products], ALLSELECTED ( DATA[Segment] ) ),
    0
)

product.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@summer18 , I think there some different data in pbix. Can you please check.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak , Thanks for checking into this.  I updated the link

 

https://drive.google.com/drive/folders/1d1ivWVWhnNzfcUGdseXiTY71pldhct5M?usp=sharing

 

Icey
Community Support
Community Support

Hi @summer18 ,

 

I have no access to your shared file. Please share it publicly.

 

 

Best Regards,

Icey

Hi @Icey , I just made the link public.  Hope you can help me on this

 

Icey
Community Support
Community Support

Hi @summer18 ,

 

Try this:

% New Products =
IFERROR (
    [Count of NEW Products]
        / CALCULATE ( [Total Count of Products], ALLSELECTED ( DATA[Segment] ) ),
    0
)

product.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Thanks @Icey .  It works!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.