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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
newgirl
Post Patron
Post Patron

Advanced filtering

Hello

 

I have a sample data model with my current project like below.

Data tables are:

Activity table - records activities made by salespersons

Creation table - records when a client was created in the database

Sales table - records sales

 

1.PNG

 

In a table visual in the report, I need to report per Salesperson, their number of activities, the volume, and accounts created. The tricky part is when I compute for the volume. It needs to capture only the volume of the clients that was created based on the date slicer. 

Right now, it just uses the simple SUM() dax and so it shows as 120 which is wrong, because it's capturing also the 20 volume from client 5002, which was created on Jan 2 (outside the date slicer). What I want displayed is 100 volume only because it comes from client 5001, which was only created in the database on Jan 1, the filtered date slicer

2.PNG

How I think the volume is being capure incorrectly:

3.PNG

How I want it to capture correctly:

4.PNG

1 ACCEPTED SOLUTION

Need to update the code as such using variables...

Volume_related = 
VAR startDate = MIN('Calendar'[Date])
VAR endDate = MAX('Calendar'[Date])
RETURN CALCULATE([Volume],USERELATIONSHIP('Calendar'[Date],'CR tbl_phrawsales'[HisSapZ0123_GEOLOC.CreatedOn])
,InvoiceDate >= startDate && InvoiceDate <= endDate
)

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@newgirl , FOr such a case you have use merge queries in power query  and get creation date of client in sales 

 

Do not expand take the min/max of the date (Aggregation)

Merge Tables (Power Query) : https://www.youtube.com/watch?v=zNrmbagO0Oo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=16

 

Or create a new column in DAX in Sales

Minx(filter('Creation Date', 'Creation Date'[Client ID] = sales[Client ID]) ,'Creation Date'[Creation Date] )

 

Then you can join with sales creation date with date, if join is inactive you can use userelationship  in measure

example

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Employees as on Date : https://youtu.be/e6Y-l_JtCq4

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak !

 

I tried what you suggested in my actual working file:

 

This is the relationship:

10.PNG

 

And this is the new measure (Vol_Cust) 

Volume_related = CALCULATE([Volume],USERELATIONSHIP('Calendar'[Date],'CR tbl_phrawsales'[HisSapZ0123_GEOLOC.CreatedOn]))

7.PNG

 

I tried to filter how the measure got 45. I understand how it works but...

8.PNG

How can I filter it further to get 22.4? The logic I want to apply is that since the date slicer in the page is filtered to Feb 1 to Feb 28, the measure should calculate for the sum of the volume filtered to the 'CreatedOn' date and the 'Invoice Date'. Hope you can help me how the measure can be improved.

9.PNG

Need to update the code as such using variables...

Volume_related = 
VAR startDate = MIN('Calendar'[Date])
VAR endDate = MAX('Calendar'[Date])
RETURN CALCULATE([Volume],USERELATIONSHIP('Calendar'[Date],'CR tbl_phrawsales'[HisSapZ0123_GEOLOC.CreatedOn])
,InvoiceDate >= startDate && InvoiceDate <= endDate
)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.