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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Bokchoy
Helper II
Helper II

indexing trading days

Hi all,

 

I have a measure that helps me index trading days shown below

var calc = CALCULATE(COUNTROWS(vw_calendar_BI), FILTER(ALL('vw_calendar_BI'), vw_calendar_BI[SingleDate] <= SELECTEDVALUE(vw_calendar_BI[SingleDate]) && vw_calendar_BI[Is_trading_day] = SELECTEDVALUE(vw_calendar_BI[Is_trading_day])),vw_calendar_BI[FinancialYear] = "2021-2022")

The measure works fine when a single slicer option is selected, but it doesn’t work as intended when both or no option is selected. (see below). Rather than combining the dates together and produce 1 index, it seems to simultaneously produce 2 separate index calculations.

 

Bokchoy_0-1639623613099.png

My desired solution is to have the measure produce the correct index value when a filter is applied, and if no filter is applied, produce the index value for the entire range ( in 1 sequence)

 



1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Bokchoy , Try like

 

var calc = CALCULATE(COUNTROWS(vw_calendar_BI), FILTER(ALL('vw_calendar_BI'), vw_calendar_BI[SingleDate] <= SELECTEDVALUE(vw_calendar_BI[SingleDate]) && vw_calendar_BI[Is_trading_day] in allselected(vw_calendar_BI[Is_trading_day])),vw_calendar_BI[FinancialYear] = "2021-2022")

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Bokchoy , Try like

 

var calc = CALCULATE(COUNTROWS(vw_calendar_BI), FILTER(ALL('vw_calendar_BI'), vw_calendar_BI[SingleDate] <= SELECTEDVALUE(vw_calendar_BI[SingleDate]) && vw_calendar_BI[Is_trading_day] in allselected(vw_calendar_BI[Is_trading_day])),vw_calendar_BI[FinancialYear] = "2021-2022")

hi @amitchandak ,

 

thanks for looking into my query, i was able to achieve what i want with the ISFILTERED() function in of my measure


Hi @amitchandak 
your measure did work when both options are selected but it no longer works when a single filter is applied.

Bokchoy_0-1639632235244.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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