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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shraddhab
Frequent Visitor

How CALCULATE function works to pass filter from many side of relationship to one side

Hi everyone,

Can someone please explain the reason behind why can calculate force relationship to filter from many side to one side of relationship. I can't get my head around the reason behind how it works.

Example:
Customer City Count := DistinctCount(Customer[CustomerCity])
Purchasing Customer City Count := Calculate([Customer City Count], Sales)

Detailed step by step explanation of why it works would be of great help.

Thank you.

4 REPLIES 4
v-lionel-msft
Community Support
Community Support

Hi @shraddhab ,

 

Please refer to Introduction to Filter Context in Power BI .

 

Best regards,
Lionel Chen

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

 

amitchandak
Super User
Super User

@shraddhab , basically, when use filter in calculate,what actually it returns, It returns a table, this means we can give a table in option where we can give filter. How table will behave depend on relation of table with measure. In you case it should give CustomerCity that has record in sales. ( As per theory , but you can check)

amitchandak
Super User
Super User

@shraddhab , if is join bidirectional, if yes you can. What are you try here a measure or a new column

//Try to check any value is not blank

Purchasing Customer City Count := Calculate([Customer City Count], not(isblank([Sales[sales])))

 

If you are looking for column, check my video

https://www.youtube.com/watch?v=czNHt7UXIe8

Hi @amitchandak , I am creating measure only and my formula posted does work. But I wanted to understand the reason behind why and how does it work conceptually? 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.