Forum Discussion
Power Bi -> Max_value and Count
- 1 year ago
Hi Molika,
I understand your requirement.
Please find the updated DAX measure below:DateCountPerID_Filtered =
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[ID] = MAX('Table'[ID])
)
)
Please refer below attached snaps for your reference.
I hope my suggestions provided valuable insights. If you have any further questions, don’t hesitate to ask in a follow-up message.
If this post helped, please mark it as "Accept as Solution" so others can benefit as well.Best regards,
Sahasra.
Hi Molika,
Thanks for using Microsoft Fabric Community Forum.
To ensure that the minimum and maximum date values calculate correctly even when the Date column is present in the visual, you must use DAX measures that remove the row context introduced by the Date column while still respecting the applied filters or slicers.
To fix the issue where the count includes dates not selected in the filter (e.g., 26.01.2025), you need to write the measure in a way that:
Groups by ID using ALLEXCEPT
Preserves filter context from slicers or visuals using KEEPFILTERS or similar
This approach ensures Min_Date and Max_Date return consistent values for all rows, regardless of Date being in the table. And the Count for each ID includes only the dates currently selected (e.g., 2 for ID 164, excluding 26.01.2025).
I hope my suggestions provided valuable insights. If you have any further questions, don’t hesitate to ask in a follow-up message.
If this post helped, please mark it as "Accept as Solution" so others can benefit as well.
Best regards,
Sahasra.
Hi,
i used the solution from rejendaongole1 but do not understand how to preserves filter context from slicers by using KEEPFILTERS. SO at the moment i got 3 for ID 164.
Count_Dates_Per_ID =
CALCULATE(
COUNTROWS('YourTable'),
ALLEXCEPT('YourTable', 'YourTable'[id])
)