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.
I have this table:
RowId | Id | StartDate | MailDate | Trips |
1 | 1 | 2019-11-20 | 2020-11-20 | 4 |
2 | 1 | 2019-11-20 | 2020-12-10 | 1 |
3 | 1 | 2019-11-20 | 2022-12-10 | 3 |
4 | 2 | 2018-11-20 | 2021-01-01 | 6 |
5 | 2 | 2018-11-20 | 2021-02-02 | 7 |
6 | 3 | 2019-01-01 | 2020-01-01 | 2 |
7 | 3 | 2019-01-01 | 2022-05-05 | 2 |
8 | 3 | 2019-01-01 | 2022-06-09 | 3 |
9 | 4 | 2015-01-01 | 2019-01-01 | 2 |
What I need to do:
I need the SUM of Trips made after each year since each Ids StartDate.
The output needs to be this table, which would look like this for the above table:
YearsPassedSinceStartDate (0-5 years is fixed interval) | Amount (this will be our calculated column) |
0 | 0 |
1 | 7 |
2 | 13 |
3 | 8 |
4 | 2 |
5 | 0 |
For example, for YearsPassedSinceStartDate with the value "1", we know that the amount is = 7.
- Why? Because RowId 1, 2 and 6's DateDiff between MailDate and StartDate is 1 year. And SUM of their trips is 4+1+2 = 7.
How do I produce the above table's calculated "Amount" column like this?
Solved! Go to Solution.
you can create a column
Column = int( DATEDIFF('Table'[StartDate],'Table'[MailDate],month)/12)
create a year table
and create a measure
Measure = sumx(FILTER('Table',max('Table (2)'[year])='Table'[Column]),'Table'[Trips])+0
pls see the attachment below
Proud to be a Super User!
you can create a column
Column = int( DATEDIFF('Table'[StartDate],'Table'[MailDate],month)/12)
create a year table
and create a measure
Measure = sumx(FILTER('Table',max('Table (2)'[year])='Table'[Column]),'Table'[Trips])+0
pls see the attachment below
Proud to be a Super User!
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 |
---|---|
110 | |
109 | |
89 | |
76 | |
66 |
User | Count |
---|---|
126 | |
112 | |
99 | |
82 | |
73 |