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.
Hi,
I have a tables with Salesforce opportunities and an other one with scheduled dates delivery for each products that an opportunity has.
An opportunity has an ID and a closing date :
id | close date |
1 | 1-Jan |
2 | 2-Feb |
3 | 2-Mar |
4 | 1-Apr |
5 | 1-May |
An item schedule has an line Item ID, opportunity ID and schedule dates :
line item ID | opportunity id | schedule date |
1 | 1 | 2-Jan |
2 | 1 | 4-Sep |
3 | 1 | 1-Dec |
4 | 1 | 4-Nov |
5 | 1 | 4-Jan |
There is a relationship between opportunity table and product table and a relationship between product and line item table but not a direct relationship between opportunity and line item.
for each opportunity I want to count the number of lineItem when the line item schedule date minus the opportunity close date is < to 1 month.
For example in this case, opportunity 1 will return 2 since the first line Item (2 jan - 1 jan = 1) and the 5th line item (4 jan - 1 jan = 3) match the case :
id | close date | close date - schedule date < 1 month ? |
1 | 1-Jan | 2 |
2 | 2-Feb | |
3 | 2-Mar | |
4 | 1-Apr | |
5 | 1-May |
when I try this formula:
Solved! Go to Solution.
Hi, try this
column = CALCULATE(COUNT('Line Item Schedule'[Id]),'Line Item Schedule'[ScheduleDate]>EARLIER([Close Date]-30)
or
colum = COUNTROW(FILTER('Line Item Schedule,,'Line Item Schedule'[ScheduleDate]>EARLIER([Close Date]-30))
Hey thanks for your help, I can't put close date in the ealier formula since its a column:
sorry, it shoule be EARLIER([close date])-30
@Broly , if relation is there then
column = CALCULATE(COUNT('Line Item Schedule'[Id]),DATEDIFF(Opportunity[CloseDate],maxx(relatedtable('Line Item Schedule'),'Line Item Schedule') [ScheduleDate],DAY)<30)
or
column = CALCULATE(COUNT('Line Item Schedule'[Id]),DATEDIFF(Opportunity[CloseDate],Minx(relatedtable('Line Item Schedule'),'Line Item Schedule') [ScheduleDate],DAY)<30)
The above calculation should also work as a measure
refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8
I have this error
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 |
---|---|
97 | |
94 | |
74 | |
71 | |
64 |
User | Count |
---|---|
143 | |
109 | |
103 | |
82 | |
74 |