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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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