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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

date intelligenceate

Hello guys, i'm doing some manipulations with dates

 

CAn u help with it because i cant find a solution i need.

On my page i will have to filter tables : year and month number

I want to count how many rows i have that satisfy my condition.

Condition is about : if i choose a date ( year and month), how many rows i have for which my date is in interval of date of entry and date of depart. ( two columns of dates that are in my principal data table). IT'is like to be able to choose a date (year and month) and then compare it to my date of entry and date of depart. If a choosen date is otsuide or inside the interval.

I decided to start with a simple : i want to calculate how many rows i have for which YEAR of my date of entry is less then the YEAR selected in a filter.
Thanks for any help
scr.png

 


Hope it was clear. I send you some screens to let it be more precise.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , That should come from date table. Based on allselected you can always get the year

 

measure =
var _max = maxx(allselected(Date),Date[Year])
return
calculate(countrows(Table), filter(all(Date),Date[Year]<=_max))

 

or

 

measure =
var _max = minx(allselected(Date),Date[Year])
return
calculate(countrows(Table), filter(all(Date),Date[Year]<=_max))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , That should come from date table. Based on allselected you can always get the year

 

measure =
var _max = maxx(allselected(Date),Date[Year])
return
calculate(countrows(Table), filter(all(Date),Date[Year]<=_max))

 

or

 

measure =
var _max = minx(allselected(Date),Date[Year])
return
calculate(countrows(Table), filter(all(Date),Date[Year]<=_max))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.