Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
I would like to exclude a column from the DATEINPERIOD filter or make sure that this filter only concerns certain columns in a calculation using the CALCULATE function.
I want to exclude [Cumulative number of session each week] from the DATESINPERIOD FILTER or make the filter affect only [Number of sessions] and [Average time per session].
I put an example below.
Thank you in advance for your answers.
Solved! Go to Solution.
@Anonymous In addition to your question, I saw how you used the data column inside the DATESINPERIOD function. This is not how you should do that. Either you have a dim dates you created or you use the autodate time table.
For simplicity, let's say you use the autodate time, than your measure is:
DIVIDE(
CALCULATE (
SUM ( 'Google analytics'[Number of sessions] )
* SUM ( 'Google analytics'[Average time per session] ),
DATESINPERIOD (
'Google analytics'[Date].[Date],
FIRSTDATE ( 'Google analytics'[Date] ),
-1,
MONTH
)
),
SUM ( 'Google analytics'[Cumulative number of session each week] )
)
Pay attention to the version I used:
'Google analytics'[Date].[Date]
Also, you don't need the ALL argument as you play with filters on the date table anyway.
@Anonymous In addition to your question, I saw how you used the data column inside the DATESINPERIOD function. This is not how you should do that. Either you have a dim dates you created or you use the autodate time table.
For simplicity, let's say you use the autodate time, than your measure is:
DIVIDE(
CALCULATE (
SUM ( 'Google analytics'[Number of sessions] )
* SUM ( 'Google analytics'[Average time per session] ),
DATESINPERIOD (
'Google analytics'[Date].[Date],
FIRSTDATE ( 'Google analytics'[Date] ),
-1,
MONTH
)
),
SUM ( 'Google analytics'[Cumulative number of session each week] )
)
Pay attention to the version I used:
'Google analytics'[Date].[Date]
Also, you don't need the ALL argument as you play with filters on the date table anyway.
@SpartaBI Thanks for your answer, I understand now how to use it ! 7
It works perfectly !
@Anonymous my pleasure 🙂
Hey, check out my showcase report - got some high level stuff there 🙂
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543
Give it a thumbs up over there if you liked it 🙂
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
11 | |
10 | |
9 | |
8 |