The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi everyone,
I'm working with a table similar to the one below and facing a challenge in creating a measure for the last column ("Forecasted Q2"). The goal is to calculate this value based on the Product class for each product.
The main challenge is that the measure needs to:
Could anyone suggest how to write such a measure in Power BI that respects the row context but also calculates the total sum accurately?
Thanks in advance!
Product code | Product class | Sales Q1 | Forecast approach Q2 | Forecasted Q2 |
Product A | Focus | 100 | Q1 + 10% | 110 |
Product B | Focus | 10 | Q1 + 10% | 11 |
Product C | Focus | 30 | Q1 + 10% | 33 |
Product D | Not focus | 50 | Q1 | 50 |
Total | 190 | 204 |
Solved! Go to Solution.
Hello @apohl1,
Thank you for reaching out to the Microsoft Fabric Community Forum.
I’ve reproduced your scenario in Power BI Desktop based on the table structure and logic you shared and I was able to get the expected output, where:
I created:
Here’s the DAX measure I used to calculate Forecasted Q2:
Forecasted Q2 =
SUMX (
SalesTable,
SalesTable[Sales Q1] * RELATED(ForecastTable[Forecast Factor])
)
For your reference and testing, I’m attaching the .pbix file.
Best regards,
Ganesh Singamshetty.
Hello @apohl1,
Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.
Thank you.
Hello @apohl1,
Thank you for reaching out to the Microsoft Fabric Community Forum.
I’ve reproduced your scenario in Power BI Desktop based on the table structure and logic you shared and I was able to get the expected output, where:
I created:
Here’s the DAX measure I used to calculate Forecasted Q2:
Forecasted Q2 =
SUMX (
SalesTable,
SalesTable[Sales Q1] * RELATED(ForecastTable[Forecast Factor])
)
For your reference and testing, I’m attaching the .pbix file.
Best regards,
Ganesh Singamshetty.
Thank you! Your solution would have worked if I was able to setup a relationship between the two tables. Unfortunately, my model is more complex and it's not possible. Howerver, I managed to get to the results I wanted with the following formula:
Thank you! Sorry I should have clarified that "Forecast factor" and "Sales" are stored in two different tables. Therefore, this solution doesn't work.
I created a column [Forecast factor Q2] with the amount to multiply by Sales Q1.
Measure:
Forecasted Q2 =
SUMX ( Table1, Table1[Sales Q1] * Table1[Forecast factor Q2] )
Proud to be a Super User!
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
24 | |
21 | |
12 | |
10 | |
7 |