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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
empyre
Frequent Visitor

Count of Rows By Date

Hello All, 

 

I have built a visual that is not correctly displaying the data. Here is how my data looks. 

 

ID - Integer - Must be populated

Created Date - Date - Must be populated

Release Date - Optional (only products that have been released will have a date)

 

Requirement

For each month in the year, visualize the # of items Created and Released. 

 

I used this thread to get started (https://community.powerbi.com/t5/Desktop/Calculate-Count-Of-Rows-Per-Month/td-p/193786)

 

Built my date tables and created the relationships the Date table.

 

image.png

 

Active = Created Date to Date

Inactive = Released Date to Date

 

When I built the visual,  Aug 2019 looked like this. 

 

image.png

 

When I look at the data, the 5 is correct for Created but the 11 is incorrect for Released. It should be 17 in total for Aug 2019. 

 

5 Created in Aug 20195 Created in Aug 2019

 

17 Total Released in Aug 201917 Total Released in Aug 2019

What am I doing wrong that only 11 show up instead of 17?

3 REPLIES 3
jdbuchanan71
Super User
Super User

@empyre 

You will have to show us the measures you are using.  When I enter your data and use these measures I get the expected result.

Created Count = 
DISTINCTCOUNT( 'Table'[ID] )
Released Count = 
CALCULATE(
    DISTINCTCOUNT( 'Table'[ID] ),
    USERELATIONSHIP( 'Table'[Released Date], Dates[Date] )
)

ReleasedCount.jpg

Also, when asking a question it helps if you supply sample data in a format that can be easily copied rather than screen shots, like so.

ID Created Date Released Date
45 10/1/2018 8/29/2019
57 10/17/2018 8/22/2019
55 10/26/2018 8/29/2019
6 11/19/2018 8/22/2019
24 11/29/2018 8/23/2019
48 1/16/2019 8/23/2019
11 3/21/2019 8/29/2019
28 4/4/2019 8/22/2019
18 4/5/2019 8/22/2019
51 4/8/2019 8/22/2019
29 5/7/2019 8/22/2019
2 5/27/2019 8/22/2019
56 6/7/2019 8/22/2019
10 6/12/2019 8/22/2019
19 7/11/2019 8/22/2019
26 7/23/2019 8/29/2019
60 8/1/2019 8/22/2019
58 8/1/2019  
25 8/6/2019  
7 8/15/2019  
35 8/23/2019  

Thank you @jdbuchanan71 . That solution works, but is it possible to use the Count on the Created or Released Date, as opposed to the Index?

 

 

@empyre 

What is it that you are trying to count exactly?  If you do 

Release Count = DISTINCTCOUNT ( 'Table'[Release Date] )

and you have 10,000 rows all with 9/1/2019 on them, they will all count as 1.

My solution assumes you can have the same ID more than once in your table.  If not you can just do

Released Count = 
CALCULATE(
    COUNTROWS ( 'Table' ),
    USERELATIONSHIP( 'Table'[Released Date], Dates[Date] )
)

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.