Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello All,
I need help with DAX.
I have 3 columns in my data set. BU,EmailId and End Date. I also have a dropdown on End Date in the dashboard. I need to calculate the count of email ids for every business unit between Jan 1st 2025 and the selected value of end date from the dropdown. I also need to count the the number of email ids with 1 count, 2 counts and 3 counts (frm the above result set) as 3 seperate measures and display in the table as Business Unit, 1 Click count, 2 Click Count and 3 Click Count.
Currently I am following this approach:
First Measure:
Solved! Go to Solution.
Hi @Sowrabha_S,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @d_m_LNK and @parry2k for the prompt response.
Thank you for confirming that all the fields come from the same table.
Here the issue is happening because the Total Count measure is still limited by the slicer context, it does not clear the filter properly when you also use the same table for the date filter.
Please use this below measure:
Total Count =
VAR SelectedEndDate = SELECTEDVALUE(RO[END_DATE])
VAR StartDate = DATE(2025,1,1)
RETURN
CALCULATE(
COUNTROWS(RO),
REMOVEFILTERS(RO[END_DATE]),
RO[END_DATE] >= StartDate &&
RO[END_DATE] <= SelectedEndDate
)
Now use your existing measures like this:
OneTimeClickers =
COUNTROWS(FILTER(VALUES(RO[EMAIL_ADDRESS]), [Total Count] = 1))
TwoTimeClickers =
COUNTROWS(FILTER(VALUES(RO[EMAIL_ADDRESS]), [Total Count] = 2))
ThreeTimeClickers =
COUNTROWS(FILTER(VALUES(RO[EMAIL_ADDRESS]), [Total Count] = 3))
This will correctly counts each email between jan 1 2025 and the selected end date from the slicer and gives you the correct results.
Thanks and regards,
Anjan Kumar Chippa
It is actually the same table (RO or RO_Clickers). All fields are coming from the same table. Sorry for the confusion!
Hi @Sowrabha_S,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @d_m_LNK and @parry2k for the prompt response.
Thank you for confirming that all the fields come from the same table.
Here the issue is happening because the Total Count measure is still limited by the slicer context, it does not clear the filter properly when you also use the same table for the date filter.
Please use this below measure:
Total Count =
VAR SelectedEndDate = SELECTEDVALUE(RO[END_DATE])
VAR StartDate = DATE(2025,1,1)
RETURN
CALCULATE(
COUNTROWS(RO),
REMOVEFILTERS(RO[END_DATE]),
RO[END_DATE] >= StartDate &&
RO[END_DATE] <= SelectedEndDate
)
Now use your existing measures like this:
OneTimeClickers =
COUNTROWS(FILTER(VALUES(RO[EMAIL_ADDRESS]), [Total Count] = 1))
TwoTimeClickers =
COUNTROWS(FILTER(VALUES(RO[EMAIL_ADDRESS]), [Total Count] = 2))
ThreeTimeClickers =
COUNTROWS(FILTER(VALUES(RO[EMAIL_ADDRESS]), [Total Count] = 3))
This will correctly counts each email between jan 1 2025 and the selected end date from the slicer and gives you the correct results.
Thanks and regards,
Anjan Kumar Chippa
Hi @Sowrabha_S,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
Hi @Sowrabha_S,
We wanted to kindly follow up to check if the solution I have provided for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
@Sowrabha_S if you are using latest Power BI version then you can create a function as shown below and pass value for each measure to get the count:
DEFINE
Function fnCountClick = ( cnt : scalar ) =>
VAR __BU = SELECTEDVALUE ( Tbl1[BU] )
VAR __Tbl =
SUMMARIZECOLUMNS (
Tbl1[Email],
Tbl1[BU] ,
"@Cnt", [Total Count]
)
RETURN
COUNTROWS (
FILTER (
__Tbl,
[BU] = __BU
&& [@Cnt] = cnt
)
)
//measure 1 count
Measure 1 = fnCountClick( 1 )
//measure 2 count
Measure 2 = fnCountClick( 2 )
//measure 3 count
Measure 3 = fnCountClick( 3 )
read more about functions here Using DAX user-defined functions (preview) - Power BI | Microsoft Learn
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I think the issue may be your Count and ALL statements on why you are only getting the selected dates. In your Dax you reference the RO Table to count the email addresses but filter the dates by the RO_Clickers table.
I think the filtering issue is because you are using the ALL function on a different table than the date references later in the DAX query.
Is there an EmailID column you can count that exists in the RO_clickers table? Could you send a screenshot of your datamodel?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!