Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I have the following problem:
There is a table column with quarterly metreage called Total. However, it is reported not quarterly but as YTD (Q2 will report Q1+Q2, Q3 will report everything since Q1 tilll Q3). I want to calculate the real metreage for each quarter.
The logic is to create a separate column for each quarter, and, for example, for each row in Q2 to calculate new values. This means that for each row I should get the Field name and then find out the same field name in Q1 and get the difference between Q2 and Q1 totals.
On the forums most of the time people recommend EARLIER function to get the value from the current row to make search. However, it is not working for me. Could anyone please help or suggest another solution to my problem?
Here is the formula (it is not fuinished yet, but I get error in EARLIER):
Total adj = IF(LEFT(Drilling[Quarter],2)="Q1",Drilling[Total],IF(LEFT(Drilling[Quarter],2)="Q2",CALCULATE(MAX(ALL(Drilling[Total]),FILTER(Drilling,Drilling[Field] = EARLIER(Drilling[Total adj])))),0))
Thanks,
Yasaui
Solved! Go to Solution.
Hi @Anonymous
You may refer to below measure. Please let me know if it matches your request or not.
Year = RIGHT(Drilling[Quarter],4)
total2 =
CALCULATE (
SUM ( Drilling[Development] ),
FILTER (
Drilling,
Drilling[Year] = EARLIER ( Drilling[Year] )
&& Drilling[Quarter] <= EARLIER ( Drilling[Quarter] )
)
)
Regards,
Cherie
@Anonymous Please post the same data (test data) in copiable format to replicate your issue and will be helpful to suggest any solution.
Proud to be a PBI Community Champion
Is this one okay?
CompanyFieldTotalExploration/AppraisalDevelopmentQuarterSales Account
| Uzenmunaygaz | Uzen | 49,383 | 0 | 49,383 | Q1 2018 | UZENMUNAYGAS |
| Uzenmunaygaz | Uzen | 114,173 | 0 | 114,173 | Q2 2018 | UZENMUNAYGAS |
| Uzenmunaygaz | Uzen | 178,746 | 0 | 178,746 | Q3 2018 | UZENMUNAYGAS |
| Uzenmunaygaz | Uzen | 184,908 | 0 | 184,908 | Q4 2017 | UZENMUNAYGAS |
| Uzenmunaygaz | Uzen | 139,632 | 0 | 139,632 | Q3 2017 | UZENMUNAYGAS |
| Uzenmunaygaz | Uzen | 94,355 | 0 | 94,355 | Q2 2017 | UZENMUNAYGAS |
| Uzenmunaygaz | Uzen | 43,720 | 0 | 43,720 | Q1 2017 | UZENMUNAYGAS |
Hi @Anonymous
You may refer to below measure. Please let me know if it matches your request or not.
Year = RIGHT(Drilling[Quarter],4)
total2 =
CALCULATE (
SUM ( Drilling[Development] ),
FILTER (
Drilling,
Drilling[Year] = EARLIER ( Drilling[Year] )
&& Drilling[Quarter] <= EARLIER ( Drilling[Quarter] )
)
)
Regards,
Cherie
Hi, @v-cherch-msft!
I do not not why, but your formula with EARLIER works perfectly fine. Probably, in my formula it had problems with IF or something else.
However, your formula was not what I asked for. I needed to calculate the difference between two quarters, but not the sum of all preceding quarters. Anyway, I was able to adapt your formula to my needs.
Thanks a lot!
Regards,
Yassaui
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 41 | |
| 37 | |
| 34 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 62 | |
| 31 | |
| 26 | |
| 25 |