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.
Hello everyone. I've been struggling with this for a while and wondering if someone can help. I'm trying to create a table that will return a count of active producers each month based on two date fields: Prod First Ship Date and Prod Term Date. Here's a look at a sample of the table:
I would like my final table to show active producers on the last day of each month. To be consider active, a producer would have [Prod First Pickup Date] <= #date# AND (Prod Term Date is Null or Prod Term Date > #date#)
I do have a calendar table joined to each of the date fields and they have all dates included in them. Ultimately, I'm looking for something like this:
I can show either Month or Last Day of Month. Don't really care about that. I was able to get the last day of the month using this formula:
Solved! Go to Solution.
If you want to do a "between" style of join like this you can't really use relationships (in fact they will cause issues). So you could either remove them entirely or use the CROSSFILTER() function to switch them off for this measure as I have done below. A pattern like the following should give you what you want
Active Producers = CALCULATE ( COUNTROWS ( FILTER ( Producer, Producer[Prod First Ship Date] <= MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] ) && ( ISBLANK ( Producer[Prod Term Date] ) || Producer[Prod Term Date] > MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] ) ) ) ), CROSSFILTER ( Producer[Prod First Ship Date], 'Prod First Ship Date Calendar'[Prod First Ship Date], NONE ) )
If you want to do a "between" style of join like this you can't really use relationships (in fact they will cause issues). So you could either remove them entirely or use the CROSSFILTER() function to switch them off for this measure as I have done below. A pattern like the following should give you what you want
Active Producers = CALCULATE ( COUNTROWS ( FILTER ( Producer, Producer[Prod First Ship Date] <= MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] ) && ( ISBLANK ( Producer[Prod Term Date] ) || Producer[Prod Term Date] > MAX ( 'Prod First Ship Date Calendar'[Prod First Ship Date] ) ) ) ), CROSSFILTER ( Producer[Prod First Ship Date], 'Prod First Ship Date Calendar'[Prod First Ship Date], NONE ) )
This worked great! As a beginner, I knew I need to use the CROSSFILTER function within my CALCULATE but didn't know where it made sense (inside the FILTER or not).
Thanks!
Eric
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
76 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |