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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Velvetine27
Helper I
Helper I

Multiple selection filters not working

Hi all,

 

I wrote a DAX to display data up till the selected month like this : 

 

%CFR=
VAR selectedYear =
    SELECTEDVALUE ( 'DATE'[Date].[Year] )
VAR selectedMon =
    SELECTEDVALUE ( 'DATE'[Date].[MonthNo] )
VAR start_ =
    DATE ( selectedYear, 1, 1 )
VAR end_ =
    DATE ( selectedYear, selectedMon + 1, 1 ) - 1

RETURN
CALCULATE(([DO] / [SO]),FILTER ( 'TABLE', 'TABLE'[date] >= start_ && 'TABLE'[date] <= end_ ))
 
 
 
Now the issue is that in my visuals if the user selects more than one month, this doesn't work. Do you guys have any suggestions how can I keep the functionality of current DAX while allowing users to select multiple months and it will show data up till the last selected month. So if users choose all months, it should display the entire year of data. Any suggestions appreciated. 
 
Thanks !
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Velvetine27 

 try like:

%CFR=
VAR selectedYear =
    YEAR(MAX('DATE'[Date]))
VAR selectedMon =
    MONTH(MAX('DATE'[Date]))
VAR start_ =
    DATE ( selectedYear, 1, 1 )
VAR end_ =
    DATE ( selectedYear, selectedMon + 1, 1 ) - 1
RETURN
CALCULATE(([DO] / [SO]),FILTER ( 'TABLE', 'TABLE'[date] >= start_ && 'TABLE'[date] <= end_ ))

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Velvetine27 ,

I created some data:

Table:

vyangliumsft_0-1673336848494.png

Date:

vyangliumsft_1-1673336848495.png

 

Here are the steps you can follow:

1. Create measure.

Flag =
var _selectyear=SELECTEDVALUE('Date'[Year])
var _selectmonth=MAXX(ALLSELECTED('Date'),[Month])
var _start=DATE(_selectyear,1,1)
var _end=EOMONTH(DATE(_selectyear,_selectmonth,1),0)
return
IF(
    MAX('Table'[date]) >=_start && MAX('Table'[date])<=_end,1,0)
Measure =
SUMX(ALLSELECTED('Table'),[DO/SO])

2. Result:

vyangliumsft_2-1673336848499.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

FreemanZ
Super User
Super User

hi @Velvetine27 

 try like:

%CFR=
VAR selectedYear =
    YEAR(MAX('DATE'[Date]))
VAR selectedMon =
    MONTH(MAX('DATE'[Date]))
VAR start_ =
    DATE ( selectedYear, 1, 1 )
VAR end_ =
    DATE ( selectedYear, selectedMon + 1, 1 ) - 1
RETURN
CALCULATE(([DO] / [SO]),FILTER ( 'TABLE', 'TABLE'[date] >= start_ && 'TABLE'[date] <= end_ ))

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.