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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Calculation using user selection/input

 

Hi, 

 

I am looking for some advice on how to deal with the following scenario. The requirement is as follows:

 

  • The user has to select one of the dates from a drop-down (and not slicer; for a yyyy-mmm format).
  • If the user selects "January 2020", the count (new calc.column) should be 2 (as two employees have joined in/before Jan 2020)
  • Similarly, the count should be 3 for "February 2020" and 4 for "March 2020".
EmployeeJoining Date
AJanuary 2020
BMarch 2020
CNovember 2019
DFebruary 2020

 

Could you please suggest a solution for this? I have used Spotfire quite extensively before, and would have used property controls, but am unable to get my head around a solution in PBI.

 

Thanks,

Vivek

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , If joining date is a date, like this you can do by selecting a month

Use date calendar table and join it with Joining date


measure =
var _month =maxx(Date,date[Month])
var _max = maxx(filter(Date,date[month]=_month),Date[date])
return
calculate(count(Table[Employee]),Filter(all(Date),Date[date]<=_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/

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

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , If joining date is a date, like this you can do by selecting a month

Use date calendar table and join it with Joining date


measure =
var _month =maxx(Date,date[Month])
var _max = maxx(filter(Date,date[month]=_month),Date[date])
return
calculate(count(Table[Employee]),Filter(all(Date),Date[date]<=_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/

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

Thank you very much sir!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.