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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
give1ngaymai
New Member

How to calculate the number of Campaigns running based on the start and end dates?

In the limited knowledge of Dax and power query functions, I still have not found a way to calculate the number of Campaigns running based on the start and end dates.

 

I have a table with sample data as follows:

Campaign nameStart date End date
Campaign A2022-07-20 2022-11-17
Campaign B2022-08-16 2022-10-10
Campaign C2022-07-23 2022-11-17
Campaign D2022-08-10 2022-11-09
Campaign E2022-07-06 2022-09-07
Campaign F2022-08-06 2022-10-06
Campaign G2022-08-24 2022-09-18
Campaign H2022-07-14 2022-11-23
Campaign I2022-07-28 2022-11-20
Campaign J2022-08-04 2022-09-24
Campaign K2022-08-03 2022-11-18
Campaign L2022-07-30 2022-10-29
Campaign M2022-07-12 2022-09-17
Campaign N2022-08-08 2022-10-29
Campaign O2022-08-11 2022-09-27
Campaign P2022-08-08 2022-09-07
Campaign Q2022-07-18 2022-09-06

I want to calculate how many campaigns are happening on 11 Aug (for example) or similar any day I want to see how many campaigns are running. Can you suggest to me some solutions?

1 ACCEPTED SOLUTION
Ethan96
Resolver I
Resolver I

Hi, @give1ngaymai 

Add a seperate calendar table and try this:

Count =
CALCULATE (
    COUNT ( 'Table'[Campaign name] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Start date] <= SELECTEDVALUE ( 'Calendar'[Date] )
            && 'Table'[End date] >= SELECTEDVALUE ( 'Calendar'[Date] )
    )
)

Ethan96_0-1660028787182.png

Sample file

 

Regards,

Ethan Fang

View solution in original post

3 REPLIES 3
Ethan96
Resolver I
Resolver I

Hi, @give1ngaymai 

Add a seperate calendar table and try this:

Count =
CALCULATE (
    COUNT ( 'Table'[Campaign name] ),
    FILTER (
        ALL ( 'Table' ),
        'Table'[Start date] <= SELECTEDVALUE ( 'Calendar'[Date] )
            && 'Table'[End date] >= SELECTEDVALUE ( 'Calendar'[Date] )
    )
)

Ethan96_0-1660028787182.png

Sample file

 

Regards,

Ethan Fang

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
MattAllington
Community Champion
Community Champion

You can use the technique I cover here. It's the same problem 

https://exceleratorbi.com.au/how-many-employees-by-period/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.