Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello, I hope you can help me with the following:
1) When the row number in the table consumption is 1 must substract the quantity of the ID of the table quantity less consumption.
2) When the row number is different to 1 must substrat the higher value of the column project less the value of the column consumption like is in the image below:
Example of my Power Bi.
Consumption table
Quantity table:
Example in Excel:
Solved! Go to Solution.
Hi @Erick24 ,
You can create a calculated column as below to get it, please find the details in the attachment.
Column =
VAR _qty =
CALCULATE (
MAX ( 'Quantity'[Quantity] ),
FILTER ( 'Quantity', 'Quantity'[ID] = 'Consumption'[ID] )
)
VAR _accsum =
CALCULATE (
SUM ( 'Consumption'[CONSUMPTION] ),
FILTER (
'Consumption',
'Consumption'[ID] = EARLIER ( 'Consumption'[ID] )
&& 'Consumption'[ROW NUM] <= EARLIER ( 'Consumption'[ROW NUM] )
)
)
RETURN
_qty - _accsum
Best Regards
Hi @Erick24 ,
You can create a calculated column as below to get it, please find the details in the attachment.
Column =
VAR _qty =
CALCULATE (
MAX ( 'Quantity'[Quantity] ),
FILTER ( 'Quantity', 'Quantity'[ID] = 'Consumption'[ID] )
)
VAR _accsum =
CALCULATE (
SUM ( 'Consumption'[CONSUMPTION] ),
FILTER (
'Consumption',
'Consumption'[ID] = EARLIER ( 'Consumption'[ID] )
&& 'Consumption'[ROW NUM] <= EARLIER ( 'Consumption'[ROW NUM] )
)
)
RETURN
_qty - _accsum
Best Regards
This is exactly what I was looking for. Thank you very much. 😊
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
78 | |
58 | |
36 | |
33 |
User | Count |
---|---|
95 | |
62 | |
56 | |
49 | |
41 |