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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
DS_mho
New Member

Active members on a certain date

Hi, 

I just recently downloaded the desktop version and am currently "playing around" and trying things out, but have run into a problem. 

I have a long list of members of a user group where every member, among other dimensions, has a startdate and an enddate, for instance: 

 

Name                                Validtodatetime                            Validfromdatetime

Lars Sorensen                    03-05-2016                                       03-02-2015

 

I would like to count all the members active on 30-12-2015, 30-01-2016, 30-02-2016 and so on. I created a new coloumn and added the following formula to evaluate whether the member was active on the 30th of december 2015 (I would create a new colum to evaluate the other months): 

 

December = IF(AND(HRPPARTYPOSITIONTABLERELAT2226[VALIDFROMDATETIME]<=30-12-2015;HRPPARTYPOSITIONTABLERELAT2226[VALIDTODATETIME]>30-12-2015);1;0)

 

The formula should return a 1 for active members and a 0 for non active members which should be easy to aggregate. So far I have handled the data in Excel in the same way and with the same formula and it works just fine. However the formula in Power BI always returns 0. 

Is there something wrong with my formula (well, obviously there is but Power Bi doesn't return any errors) or am I simply approaching the whole thing in the wrong way ? 

If so, can anyone give me a hint as to how I should handle this ?

 

Best regards 

 

Martin 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

December = IF(AND([VALIDFROMDATETIME]<=DATE(2015,12,30),[VALIDTODATETIME]>DATE(2015,12,30)),1,0)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @DS_mho,

As the @Greg_Deckler's posted, you should use the DATE(Year,Month,Day) to verify the "30-12-2015" are data type. 

Best Regards,
Angelia

Anonymous
Not applicable

@DS_mho,

For a flexible solution, I suggest you consider adding a DimDate table (e.g. per https://blogs.msdn.microsoft.com/lukaszp/2015/03/05/power-bi-dynamic-date-filtering/)

 

Then you can use an "Active..." measure similar to the one discussed here (in Excel, but transferable to PBI) - https://www.powerpivotpro.com/2013/04/counting-active-rows-in-a-time-period-guest-post-from-chris-ca... 

Greg_Deckler
Community Champion
Community Champion

December = IF(AND([VALIDFROMDATETIME]<=DATE(2015,12,30),[VALIDTODATETIME]>DATE(2015,12,30)),1,0)


Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors