Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have this table with a rate calculation want to be able to select mutiple date and not get an error
Table image
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.
Solved! Go to Solution.
@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
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
@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
@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)
)
)
)
)
Proud to be a Super User! |
|
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
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
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
72 | |
38 | |
31 | |
26 |
User | Count |
---|---|
97 | |
86 | |
43 | |
40 | |
35 |