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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Krishna09
Helper III
Helper III

Filter fiscal year data based on two date columns

Hello all,

 

In Table 1, there are two date fields(one is start and expiration date) and one ID field. 

I have a other table with calender date, month, year, fiscal year columns. 

I need to create a filter, based on selection of fiscal year , it should show ID's which are in the range of start and expiration date.

Is there a way or any alternate way. Please suggest me.

Krishna09_0-1697107186422.png

Krishna09_1-1697107209669.png

 

 

1 ACCEPTED SOLUTION

Hi @Krishna09 ,

You can simply add it to the visual's filter and set the condition equal to 1.

vcgaomsft_0-1697530414260.png

Best Regards,
Gao

Community Support Team

View solution in original post

5 REPLIES 5
v-cgao-msft
Community Support
Community Support

Hi @Krishna09 ,

You will need an unconnected fiscal table with a start date and end date for a fiscal year:

vcgaomsft_0-1697529106367.png

Then create a measure like:

Measure = 
VAR _start_date = MAX('FYCalendar'[StartDate])
VAR _end_date = MAX('FYCalendar'[EndDate])
VAR _result = IF(ISBLANK(SELECTEDVALUE('FYCalendar'[FiscalYear]))||(_start_date>=MAX('Table'[Start Date]) && _end_date<=MAX('Table'[Expiration Date])),1)
RETURN
_result

And the output:

vcgaomsft_1-1697529165231.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

@v-cgao-msft , @amitchandak ,

Thank you both.

is it possible to show only the row based on ID, with out measure count in the table?

Hi @Krishna09 ,

You can simply add it to the visual's filter and set the condition equal to 1.

vcgaomsft_0-1697530414260.png

Best Regards,
Gao

Community Support Team

Hello @v-cgao-msft , 

I used the formulae you mentioned, but it works only when I use in table filter.

--- it is not working if I mention it, then the table is filtered only based on start date. 

--- AND it is also not working in pie or other visuals.

 

I have multiple tables connected to this visuals.

 

Below is the experssion I am using.

ContractExp_year = CALCULATE(COUNTX(filter('ContractExpiration','ContractExpiration'[[PCW]]Contract (Effective Date)]<= MAX(FiscalYearfFromOctober[Date])&&
'ContractExpiration'[[PCW]]Contract (Expiration Date)]> MAX(FiscalYearfFromOctober[Date])),'ContractExpiration'[[PCW]]Contract (Contract Id)]),
CROSSFILTER(FiscalYearfFromOctober[Date],'ContractExpiration'[[PCW]]Contract (Effective Date)],None))
 
 
 

Krishna09_1-1698591036099.png

 

Krishna09_0-1698590868976.png

 

amitchandak
Super User
Super User

@Krishna09 , I think smimilar to HR Analytics

 

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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