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
Philandcas
Frequent Visitor

Noob question about using the Calculate and DistinctCount functions and dates

Hi all,

New to PBI and have started working on few projects and so far am a big fan of the product but I'm new and have a think is a simple quesiton but I'm stuck and seeking some help.

 

Objective -  I want to create a Measure that counts the number of distinct files, with a certain status after a certain date.

 

Attempt so far -

CNT files - Closed 22/23 FY = CALCULATE(
DISTINCTCOUNT('TABLE'[ID]), 'TABLE'[File status] = "Closed",'TABLE'[Date Closed] > 01/07/2022)

It works fine with just the File status filter but when I add the date filter I return no results yet I know there are many in the database.
All assistance would be great.
Cheers
Phil
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Philandcas 
Please try

CNT files - Closed 22/23 FY =
CALCULATE (
    DISTINCTCOUNT ( 'TABLE'[ID] ),
    'TABLE'[File status] = "Closed",
    'TABLE'[Date Closed] > DATE ( 2022, 7, 1 )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @Philandcas 
Please try

CNT files - Closed 22/23 FY =
CALCULATE (
    DISTINCTCOUNT ( 'TABLE'[ID] ),
    'TABLE'[File status] = "Closed",
    'TABLE'[Date Closed] > DATE ( 2022, 7, 1 )
)

@tamerj1Thank you, that works perfectly.

Can I ask, when using dates in the Calculate function is the above layout "DATE (yyyy, mm, DD)" the only way to write them? Just asing as this will be something  will need to do 100's of times.

Cheers

Phil

amitchandak
Super User
Super User

@Philandcas , if you are adding a close date filter, that is less than 1-jul-2022, this measure will not give any value as that value has been hard coded for > filter

@amitchandakThank you for the reply.

I'm actually only seeking a count of files that have been closed in this Finacial Year i.e. 01/07/2022 through to 30/06/2023.

 

If I use the "Filters on this visual" function I get the result i'm seeking, just can't seem to get a measure to achieve the same result.

Philandcas_0-1659540203162.png

Any other ideas.

Cheers

Phil

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors