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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Single Slicer for Period

Hi All,

 

I have two dates, From and To.

 

I have created one Dimension Date table for slicer.

 

Objective is to calculate count if slicer date lye between from and to date.

 

Here is the Dax for for Count, Its working fine if I have From and To Date available in Grid, but when i remove these columns from Grid so i have wrong count.

 

SR Count =

var flag =
IF (
SELECTEDVALUE ( 'CompanyInvolvment'[SrFromDate] ) <= MAX ( DimDate[FullDateAlternateKey] )
&& SELECTEDVALUE ( 'CompanyInvolvment'[SrToDate] ) >= MIN ( DimDate[FullDateAlternateKey] )
,
1,0
)
var SRCount =
IF (
flag = 1, CALCULATE(DISTINCTCOUNT('CompanyInvolvment'[SR_Number])) + 0,0

)
return CONVERT(SRCount,INTEGER)
 
Current selection in slicer is Sep,22. This is correct result when i have dates in Grid
farhadidrees_0-1666273024289.png

 

But when i remove Dates from Grid so it becomes 0 There should be Total 3 Count.

farhadidrees_1-1666273087756.png

This is the issue, i dont want to show Dates in grid.

 

Any suggestion?

 

Regards,

 

 
2 REPLIES 2
Jayee
Responsive Resident
Responsive Resident

Hi @Anonymous 

 

try below DAX if the field SR_Number unique to table CompanyInvolvment then it works otherwise need to modify the DAX to solve your requirement.

SR Count =
COUNTX (
CompanyInvolvment,
IF (
SELECTEDVALUE ( 'CompanyInvolvment'[SrFromDate] )
<= MAX ( DimDate[FullDateAlternateKey] )
&& SELECTEDVALUE ( 'CompanyInvolvment'[SrToDate] )
>= MIN ( DimDate[FullDateAlternateKey] ),
1,
0
)
)

 

Anonymous
Not applicable

Hi Jayee, 

 

Thanks for response.

I modify the DAX and having Unique SR Numbers but still it is having wrong counting as shown below.

Filter selection is septembr,2022 but it is counting some other values as well which is not lying between this date.

 

farhadidrees_1-1666328686878.png

Any idea?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.