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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Kay_Kalu
Frequent Visitor

Error on Multiple date selection

I have this table with a rate calculation want to be able to select mutiple date and not get an error

Table image

Kay_Kalu_1-1744377689000.png

The dax use to generate the rate is 

TerminationsCount = COUNTROWS(P_MDT002_TERMINATIONS_LAPSES) / ActivePolCount = countrows(FILTER(P_MDT000_MASTER,P_MDT000_MASTER[EFFECTIVE_DATE]<=ALLSELECTED('LIGHTHOUSE_CALENDAR'[SelectionDate])&&RELATED('REF070_PRODUCT_TAXONOMY'[MIGRATION_DATE])<=ALLSELECTED('LIGHTHOUSE_CALENDAR'[SelectionDate])&&or(P_MDT000_MASTER[STATUS]<6000,and(P_MDT000_MASTER[STATUS]>=6000,P_MDT000_MASTER[STAT_DATE]>ALLSELECTED('LIGHTHOUSE_CALENDAR'[SelectionDate])))))

 

I did build the dashboard but have to resovlve this issue any Ideas I know it might be diffcult to really understand but I can't share more than this.

1 ACCEPTED SOLUTION
HarishKM
Memorable Member
Memorable Member

@Kay_Kalu Hey,
Can you please below measure?

TerminationRate =
VAR SelectedDate = MAX('LIGHTHOUSE_CALENDAR'[SelectionDate])

VAR TerminationsCount = COUNTROWS(P_MDT002_TERMINATIONS_LAPSES)

VAR ActivePolCount =
COUNTROWS(
FILTER(
P_MDT000_MASTER,
P_MDT000_MASTER[EFFECTIVE_DATE] <= SelectedDate &&
RELATED('REF070_PRODUCT_TAXONOMY'[MIGRATION_DATE]) <= SelectedDate &&
(
P_MDT000_MASTER[STATUS] < 6000 ||
(
P_MDT000_MASTER[STATUS] >= 6000 &&
P_MDT000_MASTER[STAT_DATE] > SelectedDate
)
)
)
)

RETURN
DIVIDE(TerminationsCount, ActivePolCount, 0)

 

 

Thanks
Harish M
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Kay_Kalu,

 

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,
Vinay Pabbu

HarishKM
Memorable Member
Memorable Member

@Kay_Kalu Hey,
Can you please below measure?

TerminationRate =
VAR SelectedDate = MAX('LIGHTHOUSE_CALENDAR'[SelectionDate])

VAR TerminationsCount = COUNTROWS(P_MDT002_TERMINATIONS_LAPSES)

VAR ActivePolCount =
COUNTROWS(
FILTER(
P_MDT000_MASTER,
P_MDT000_MASTER[EFFECTIVE_DATE] <= SelectedDate &&
RELATED('REF070_PRODUCT_TAXONOMY'[MIGRATION_DATE]) <= SelectedDate &&
(
P_MDT000_MASTER[STATUS] < 6000 ||
(
P_MDT000_MASTER[STATUS] >= 6000 &&
P_MDT000_MASTER[STAT_DATE] > SelectedDate
)
)
)
)

RETURN
DIVIDE(TerminationsCount, ActivePolCount, 0)

 

 

Thanks
Harish M
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

bhanu_gautam
Super User
Super User

@Kay_Kalu , Try using

dax
TerminationsCount =
VAR SelectedDates = ALLSELECTED('LIGHTHOUSE_CALENDAR'[SelectionDate])
RETURN
COUNTROWS(
FILTER(
P_MDT002_TERMINATIONS_LAPSES,
P_MDT002_TERMINATIONS_LAPSES[TERMINATION_DATE] IN SelectedDates
)
)

ActivePolCount =
VAR SelectedDates = ALLSELECTED('LIGHTHOUSE_CALENDAR'[SelectionDate])
RETURN
COUNTROWS(
FILTER(
P_MDT000_MASTER,
P_MDT000_MASTER[EFFECTIVE_DATE] <= MAX(SelectedDates) &&
RELATED('REF070_PRODUCT_TAXONOMY'[MIGRATION_DATE]) <= MAX(SelectedDates) &&
(
P_MDT000_MASTER[STATUS] < 6000 ||
(
P_MDT000_MASTER[STATUS] >= 6000 &&
P_MDT000_MASTER[STAT_DATE] > MAX(SelectedDates)
)
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks for help but this hasn't work got this error on the ActivePolCount  dax "The MAX function only accepts a column reference as an argument." tried removing the max function but the multiple date selection still came up with an error.

For context the selectedDate dax 

"SelectionDate = IF(AND('LIGHTHOUSE_CALENDAR'[Month_Year]>=DATE(2015,01,01),'LIGHTHOUSE_CALENDAR'[Month_Year]<=EDATE(TODAY(),-1)),'LIGHTHOUSE_CALENDAR'[Month_Year])"

this might help in understanding the build.

 

Thanks

Anonymous
Not applicable

Hi @Kay_Kalu,

 

Comparison operators like <= require a single scalar value.

Use an iterator function like MAXX, which evaluates a column over the table returned by ALLSELECTED and returns a single value.

 

Regards,

Vinay Pabbu

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors