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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SSWADOOD
Helper I
Helper I

DAX FOR PLSQL

Hello, 

 

i am trying to convert 

SSWADOOD_0-1625736069729.png

into dax

DATE_BETWEEN =
var SDATES= MIN('START_DATE'[START_DATE])
var EDATES= MAX('end_DATE'[end_DATE])
 
return

IF
(
(DATESBETWEEN(DETAILS[EFF_DATE],SDATES,EDATES))
||
(DATESBETWEEN(DETAILS[EXPIRY_DATE],SDATES,EDATES))
||
(MAX([EFF_DATE])<=SDATES && MAX([EXPIRY_DATE])<=EDATES )
,1,0
)

where

sdate value is from after date slicer and 

edate value is from before date slicer 

and EFF_DATE and EXPIRY_DATE are two columns in my table visuals

SSWADOOD_1-1625737351711.png

 

 when i add this measure to the table visual i get the error 

MdxScript(Model) (14, 4) Calculation error in measure 'DETAILS'[DATE_BETWEEN]: A table of multiple values was supplied where a single value was expected.

 

can anybody help in this matter

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@SSWADOOD , I think you need something like this

 

measure 2 =
VAR minDate = MINX( allselected('Calendar') , 'Calendar'[Date] )
VAR maxDate = MAXX(allselected('Calendar') , 'Calendar'[Date] )
RETURN

calculate(countrows(Table), filter(Table, (Table[term start Date] <=_max && Table[term start Date] >=_min) || (Table[term end Date] <=_max && Table[term end Date] >=_min)))

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

@SSWADOOD , I think you need something like this

 

measure 2 =
VAR minDate = MINX( allselected('Calendar') , 'Calendar'[Date] )
VAR maxDate = MAXX(allselected('Calendar') , 'Calendar'[Date] )
RETURN

calculate(countrows(Table), filter(Table, (Table[term start Date] <=_max && Table[term start Date] >=_min) || (Table[term end Date] <=_max && Table[term end Date] >=_min)))

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

Thanks amit, 

Your measure works great , after updating it, got it to work on the inbetween date slicer.

 

 

measure 2 =
VAR minDate = MINX( allselected('START_DATE') , 'START_DATE'[START_DATE] )
VAR maxDate = MAXX(allselected('START_DATE') , START_DATE[start_DATE] )
RETURN
calculate
(
countrows(DETAILS),
filter (DETAILS,
       (DETAILS[EFF_DATE] <= maxDATE && DETAILS[EFF_DATE] >= minDATE)
       ||
       (DETAILS[EXPIRY_DATE] <= maxDATE && DETAILS[EXPIRY_DATE] >= minDATE)
       ||
       (DETAILS[EFF_DATE]<= minDATE && DETAILS[EXPIRY_DATE] >= maxDATE)
   )
)
 
 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.