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
Anonymous
Not applicable

Number of active projects per month knowing start date and end date

Hi Power BI Community,

 

I am trying to create a measure to know the number of active projects per project manager per month.

 

My source data looks like this:

projectsProject Managerstart dateend date
projet 1PM1March-22null
projet 2PM2April-22May-22
projet 3PM1February-22May-22
projet 4PM1March-22July-22
projet 5PM3March-22August-22
projet 6PM2April-22null
projet 7PM4February-22null
projet 8PM4March-22June-22

 

I would like my result in Power BI to look like this:

 January-22February-22March-22April-22May-22June-22July-22August-22September-22October-22November-22December-22
PM1013322111111
PM2000211111111
PM3001111100000
PM4012221111111

 

I feel like it's not too difficult but somehow I can't wrap my head around this!

 

Let me know if you need more information.

 

Thank you

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



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

5 REPLIES 5
Anonymous
Not applicable

OK, it gets interesting.

As stated above, it works nicely in Power BI Desktop. When I publish it to the service and refresh the dataset, it breaks the count! 

Anonymous
Not applicable

Final update: 

For some reason, updating the dataset in Power BI desktop was working smoothly, however, as stated above, updating the dataset from the Power BI Service was no working properly. The cause was that the MySQL database (on-prem with a data gateway) startDate and endDate columns were sometimes null or 0000-00-00. The later was not working with the Power BI Service.  

I then changed my SQL query to null those messy dates.

Anonymous
Not applicable

Thank you for your replies. I currently don't have the time to test all this but I'll get back to you.

 

Thanks again.

 

edit: I accepted Greg's solution as it is more adapted to my need.

The first link you provided works beautifuly !

 

Thank you very much

 

Based on the source data I provided above, the working measure is:

 

Projects Open =
VAR tmpProjects = ADDCOLUMNS('data',"Effective Date",IF(ISBLANK([end date]),TODAY(),[end date]))
VAR tmpTable =
SELECTCOLUMNS(
FILTER(
GENERATE(
tmpProjects,
'date'
),
[date] >= [start date] &&
[date] <= [Effective Date]
),
"ID",[projects],
"Date",[date]
)
VAR tmpTable1 = GROUPBY(tmpTable,[ID],"Count",COUNTX(CURRENTGROUP(),[date]))
RETURN COUNTROWS(tmpTable1)

 

This is assuming there is a non joined calendar table named 'date' containing the column [date] (created using Power Query for this test).

Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Power Query – Select [start date] , [end date] – Transform – Unpivot Columns.

vyangliumsft_0-1673847693856.png

Result:

vyangliumsft_1-1673847693859.png

2. Rows – [Project Manager] , Columns – [Value] , Value –Set [Projects]  to Count.

vyangliumsft_2-1673847693860.png

3. Result:

vyangliumsft_3-1673847693862.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Greg_Deckler
Community Champion
Community Champion

@Anonymous 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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
Top Kudoed Authors