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
benabdillahr
Frequent Visitor

DAX ALLEXCEPT function with RELATED table columns as filters

Hi All,

I am trying to calculate the distinct count of a field "Visits" but only need it to be filtreable by a "Date" field from another table.
I used the ALLEXCEPT funtion but the filter and formula only work when the "Date" field from the same table, when I use the "Date" field from the "Date" table, it doesn't work. 

Same Table Formula:

Total visits = CALCULATE( DISTINCTCOUNT(Visits[Visits: Visits Id]),
ALLEXCEPT(Visits, Visits[Date]))
benabdillahr_1-1637371691046.png

 

Related Tables Formula:
Total visits = CALCULATE( DISTINCTCOUNT(Visits[Visits: Visits Id]),
ALLEXCEPT('Date','Date'[Date])

 

benabdillahr_2-1637371708053.png


Thanks,



9 REPLIES 9
v-yanjiang-msft
Community Support
Community Support

Hi @benabdillahr ,

According to your description, here's my solution.

vkalyjmsft_0-1637662651814.png

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

smpa01
Super User
Super User

@benabdillahr may be try this

 

 

CALCULATE( DISTINCTCOUNT(Visits[Visits: Visits Id]),
ALL('Date'),VALUES('Date'[Date]), ALL(Visits[Category]))

replicated on a small scale, pbix is attached

 

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Unfortunately, I get the same result ☹️

benabdillahr_0-1637600092827.png

 

@benabdillahr  please provide a sample pbix representative of the issue

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Hi @smpa01 !

Here is exactly what I'm looking for, i just need the date filter to come from the date table instead of the visits table.

 

@benabdillahr  please check page2

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

@benabdillahr  did you have a chance to look into the solution I provided?

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
smpa01
Super User
Super User

@benabdillahr can you test out if this works for you

CALCULATE( DISTINCTCOUNT(Visits[Visits: Visits Id]),

ALL('Date'),VALUES('Date'[Date]))

 

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Thank you @smpa01 for you response!
I tried your formula, the date filter from the related table is now working but it calculates the distinct count of visits by category. I want my measure to ignore the categories in order to have the same value "243" repeated for each category since I'm using it as a denominator for another measure.

benabdillahr_0-1637591540080.png

Thanks!

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!

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.

Top Solution Authors
Top Kudoed Authors