Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I am working on creating injury logs. Here is the sample data:
Case | Type | Start Date | Days |
X | LD | 9/1/2017 | 100 |
X | LD | 12/1/2017 | 20 |
X | LT | 10/1/2017 | 40 |
X | LT | 11/1/2017 | 80 |
Y | LT | 10/1/2017 | 50 |
Y | LT | 9/1/2017 | 50 |
Y | LD | 10/1/2017 | 70 |
Y | LD | 11/1/2017 | 90 |
Y | LT | 12/1/2017 | 30 |
I need to aggregate the total periods for Cases X and Y based on the Type (LD or LT). The rules are:
Here is the results I am looking for:
LD | LT | |
X | 120 | 60 |
Y | 50 | 130 |
I appreciate your help!
Solved! Go to Solution.
Hi @mvrali,
It seems like you need to calculate based on specific sort order, I think you need to add index column to calculate loop table.
Steps:
1. Enter into query editor and add index column.
2. Add calculated column to change days based on rolling target.
Filtered Days = VAR _previous = SUMX ( FILTER ( Test, [Case] = EARLIER ( Test[Case] ) && [Index] < EARLIER ( Test[Index] ) ), [Days] ) VAR _current = SUMX ( FILTER ( Test, [Case] = EARLIER ( Test[Case] ) && [Index] <= EARLIER ( Test[Index] ) ), [Days] ) RETURN IF ( _current <= 180, [Days], IF ( _previous < 180 && _current > 180, 180 - _previous, 0 ) )
3. Create matrix visual with above columns.
Regards,
Xiaoxin Sheng
Hi @mvrali,
It seems like you need to calculate based on specific sort order, I think you need to add index column to calculate loop table.
Steps:
1. Enter into query editor and add index column.
2. Add calculated column to change days based on rolling target.
Filtered Days = VAR _previous = SUMX ( FILTER ( Test, [Case] = EARLIER ( Test[Case] ) && [Index] < EARLIER ( Test[Index] ) ), [Days] ) VAR _current = SUMX ( FILTER ( Test, [Case] = EARLIER ( Test[Case] ) && [Index] <= EARLIER ( Test[Index] ) ), [Days] ) RETURN IF ( _current <= 180, [Days], IF ( _previous < 180 && _current > 180, 180 - _previous, 0 ) )
3. Create matrix visual with above columns.
Regards,
Xiaoxin Sheng
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
123 | |
78 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |