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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
jnpb
Helper I
Helper I

Have a specific field value count as one of each of two other values

I have a measure that counts rows to get a total number of orders YTD. It's built like this:

 

Orders YTD = CALCULATE(COUNT('PurchaseReport'[OrderId]),DATESYTD('PurchaseReport'[Created].[Date]))

 

A slicer in my my report then filters by a specific product category. Data is structured in this way:

 

OrderID      Product Category

23458         Apple

08821         Orange

12340         Banana

81237         Apple/Orange

58342         Apple/Banana

 

The idea being that slicing by product category gives the YTD order total per category.

 

However, we have a combination product type for which a count of 1 should be applied to both products (e.g. Apple/Orange should count as 1 count in Apple, 1 count in Orange). Since the Orders YTD simply counts the column for the total number of orders, I don't know how to work this in so that anytime a combination product type value is given, it treats each as its' own row count for that product.

 

Assuming I have to rethink how I'm tabulating orders per product type, what would be the right approach here?

 

Thanks!

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Once you have split data into rows (as suggested by FreemanZ), follow these steps

1. Create a Calendar Table

2. Create a relationship (Many to One and Single) from the Created column to the Date column of the Calendar Table

3. To your visual, drag the Date from the Created column

4. Write these measures:

Total = COUNT('PurchaseReport'[OrderId])

Total YTD = calculate([Total],datesytd(Calendar[Date],"31/12"))

Hope this helps.

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
FreemanZ
Super User
Super User

hi @jnpb 

You would need to split the column to rows firstly in Power Query, like this:

https://community.powerbi.com/t5/Desktop/Power-Query-Split-data-onto-individual-rows/td-p/1928351

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.