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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.