Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 44 | |
| 42 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 72 | |
| 67 | |
| 33 | |
| 32 | |
| 31 |