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
bernate
Helper II
Helper II

Distinct count of products that fell into a category during a certain time period

Hello, I am trying to get a distinct count of products that fell into a category during a certain time period.

 

  • The "Archived" table contains the categories products fall into, depending on how they were classified at the time. The "Archived" table also has a Doc Version Date field based on when the document version went into effect. The Doc Version Date field contains duplicates because groups of categories are updated at once on one date.
  • The "Product" table contains product information and an initiation date. The Product ID and Initiation Date fields may contain duplicates.
  • The "Date Table" contains unique Date Key fields.

bernate_1-1713559004174.png

Product is connected to Date Table on DateTable.DtKey--->---Product.Initiation Date. Archived is connected to Date Table on Archived.DocVersionDate ---<>---DateTable.DtKey.

 

I want to know the distinct count of products that fell into a category during a certain time period. For example, between 2/21/2019 and 09/8/2019, there were 540 products that had an initiation date during that time. I want that number (540) displayed in the Doc Version Date of 02/21/19 because that's how many products were initiated before the new Doc Version on 09/09/2019.

bernate_2-1713559619476.png

Is there a simple way to do this using a measure, or would I have to alter something in my model or in Power Query to get this to work?

1 ACCEPTED SOLUTION

4 REPLIES 4
bernate
Helper II
Helper II

Hi, please try this link. I added the PBIX file and the Excel file where the tables come from. 

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

 

Below is the result I am wanting in the second table visual.

bernate_0-1713802125117.png

 

lbendlin_0-1713993872633.png

 

 

Thank you for your help!

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.