Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Team, I have a sales database where I want to count the distinct orders by either the date they were submitted or the first time they had a posted date. In other words, we have orders, which are submitted and then can have multiple shipments/postings over time - e.g. one order may have a posting in May, August and December, but I only want to count the order once. I'm thinking we could either use the order submit date or the date first posted. How can I do this with DISTINCTCOUNT? Can we do it both ways - one based on the order submit date and the other on the first date posted? Remember, an order may count as distinct in multiple months. How can I make sure it is only counted once? Do I need to use CALCULATE and ALL somehow?
If you have any specific question on creating the report, share us your table structure and the desired output.
Perhaps I am missing something, but if you use DISTINCTCOUNT, it doesn't matter how many times an order appears in the table as long as it has the same order id.
Measure = DISTINCTCOUNT('Distinct'[OrderID])
@v-chuncz-msftand @Greg_DecklerPerhaps there's something wrong with our data or the formula? I'm trying to calculate a running order count for generic months over time. NOTE: This data is for customers with contracts that all have different start dates, so we had to create a generic calendar with years, quarters and months simply numbered as 1,2,3,4, etc.; hence the filtering below and the reason we cannot use built-in time functions.
Whether I use:
Order Count = DISTINCTCOUNT('Analytics'[OrderNum])
Or use Count of OrderNum (Distinct) in the line graph visual, the results are the same:
Counts by Month =
Mo. Order Count
1 39
2 42
3 33
4 23
Counts YTD are then showing =
Mo. Order Count
1 39
2 77
3 104
4 125
However, if the Monthly counts are correct, then the YTD counts are incorrect (or vice versa - if YTD counts are correct, then monthly are incorrect). For example, if monthly counts calculated above are correct, then YTD, SHOULD be:
Mo. Order Count
1 39
2 81
3 114
4 137
Here's the formula I'm using for YTD Count:
Count Orders YTD = CALCULATE ((DISTINCTCOUNT('Analytics'[OrderNum])), FILTER (ALL(Champ_Calendar_Lookup), Champ_Calendar_Lookup[Champ_Calendar_Year] = MAX (Champ_Calendar_Lookup[Champ_Calendar_Year]) && Champ_Calendar_Lookup[Champ_Calendar_Month] <= MAX (Champ_Calendar_Lookup[Champ_Calendar_Month] )))
YTD order counts are coming out too low.
Maybe I'm just missing something simple?
Thanks for any help!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
37 | |
31 |
User | Count |
---|---|
83 | |
64 | |
63 | |
49 | |
45 |