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
rjiang
Helper I
Helper I

Datesinperiod not working as intended

Hi, I am having issues I suspect is related to the Datesinperiod function:

 

 

rjiang_1-1649351247242.png

 

The visual on the left is showing number of clicks by month by Contact ID

The visual on the right shows the number of clicks in the last 3 months (not including current month) and is calculated as follows:

 

Clicks L3 = 
    CALCULATE(
        GS_WEBMETRICS_CLICK_MONTH[Number of Clicks],
        DATESINPERIOD(
            GS_WEBMETRICS_CLICK_MONTH[CLICK_MONTH],
            MAX(GS_WEBMETRICS_CLICK_MONTH[CLICK_MONTH])-1,
            -3,
            MONTH
        )
    )

 

While the totals seem to add up correctly to 1.365m, you'll notice that the visual on the right is not displaying all contacts

For instance, contacts 1, 29, and 35 are in the visual on the left, but absent from the one on the right.

 

Any suggestions on how to modify the date logic such that the right visual shows all contacts where [Clicks L3] >0 show up?

 

Thanks

2 REPLIES 2
amitchandak
Super User
Super User

@rjiang , Please prefer to use date table marked as date tbale in such cases

 

Clicks L3 =
CALCULATE(
GS_WEBMETRICS_CLICK_MONTH[Number of Clicks],
DATESINPERIOD(
Date[Date],
MAX(Date[Date])-1,
-3,
MONTH
)
)

 

 

Rolling Months Formula: https://youtu.be/GS5O4G81fww

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I forgot to mention the data is coming in from direct query, so I can't create a functioning date table to filter form

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.