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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Isidro
Helper IV
Helper IV

Measure that counts on a date column other than the date column that is used in a slicer.

Hello,

 

I have the following table:

 

START DATEEND DATE
101/04/201008/06/2014
208/06/201010/04/2015
306/06/201208/04/2015
401/10/201206/08/2016
504/03/201310/10/2016
606/06/201314/11/2017
714/04/201415/12/2017
820/11/201410/06/2017
915/11/2015 
1016/10/2016 
1114/02/2017 
1208/08/2017 
1320/02/2018 
1404/05/2018 

 

This table is related to a calendar table through the start date. 

 

I have a slicer created with the year of the calendar table. What I want is to know how I can count the data in the end date column in each year.

For example, if you filter in 2010, the number to count of the end date column is 0 and if you filter in 2015, the number to count of the end date column is 2.

Thank you very much and best regards.

1 ACCEPTED SOLUTION

Hello @Anonymous and @Greg_Deckler,

 

I found the solution with the USERELATIONSHIP function. As you said, the end date column is related to the calendar table, with the inactive relation. Then I created the following formula:

 

MEASURE = CALCULATE (COUNT(TABLE1(END_DATE)); USERELATIONSHIP(TABLE1(END_DATE);CALENDARTABLE(DATE))

 

The USERELATIONSHIP function activates the relation for the calculation.

 

Thank you very much and best regards.

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

 

Measure = COUNTROWS(VALUES('Table'[END DATE]))

 

?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hello @Greg_Deckler,

 

I have tried the measurement but the result that it gives me is erroneous.

Thank you very much for your help and best regards.

Anonymous
Not applicable

Hi @Isidro,

Have you tried: Measure = COUNTA(Table1[END DATE]) ?

This gives me the answers you are looking for. Hope this helps.

Edit: note that I have related the Date table with the END DATE

Hello @Anonymous and @Greg_Deckler,

 

I found the solution with the USERELATIONSHIP function. As you said, the end date column is related to the calendar table, with the inactive relation. Then I created the following formula:

 

MEASURE = CALCULATE (COUNT(TABLE1(END_DATE)); USERELATIONSHIP(TABLE1(END_DATE);CALENDARTABLE(DATE))

 

The USERELATIONSHIP function activates the relation for the calculation.

 

Thank you very much and best regards.

Hello @Anonymous,

 

It works if I change the relationship of the calendar table with the column, but I also need to do a count with the start date column. I need to be able to count with the existing relationship.

Thank you very much for your help and best regards.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.