Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
zself
Regular Visitor

Calculating difference per row with initial row filter

I don't know how to ask this question properly, but here's my quick measure and a screen shot showing what I want.

Investment % difference from 2019 = 
IF(
	NOT ISBLANK(SUM('tbl_ConsolidatedYears'[Investment A])),
			SUM('tbl_ConsolidatedYears'[Investment A]) - CALCULATE(
			SUM('tbl_ConsolidatedYears'[Investment A]),
			'tbl_ConsolidatedYears'[Transaction Year] = "2019"
		),
		CALCULATE(
			SUM('tbl_ConsolidatedYears'[Investment A]),
			'tbl_ConsolidatedYears'[Transaction Year] = "2019"
		)
)

I'm trying to create a visual of the difference of a measure by year, with a set year (filtered) as the base. Here's a screen shot that includes the PowerBI results and the Excel mock-up of what I want. What's inside the red box is what I want, the green box is what I'm getting. 

zself_0-1657831879198.png

Thanks in advance for your help! I'm pulling my hair out.

5 REPLIES 5
v-cazheng-msft
Community Support
Community Support

Hi @zself ,

 

May I know whether your issue has been resolved? If you still have problems, could you please provide some sample data of your tables and let me know the relationships between them and how you create your Table visual in Power BI? Thanks in advance!

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Here is a link to a zip file containing the PB Desktop file and the sample data:

Sample files 

How do I provide sample data? 

zself_0-1658442311107.pngzself_1-1658442331286.png

Here are screen shots of the PB pages that include a table of the summarized data.

 

Thank you for the reply. No, my issue remains. I will provide some sample data and such in a separate reply.

zself
Regular Visitor

I think I pasted wrong code. Here's my most recent attempt at the measure:

Investment A difference from 2019 =
VAR __BASELINE_VALUE =
    CALCULATE(
        SUM('tbl_ConsolidatedYears'[Investment A]),
        'tbl_ConsolidatedYears'[Transaction Year] IN { "2019" }
    )
VAR __MEASURE_VALUE = SUM('tbl_ConsolidatedYears'[Investment A])
RETURN
    IF(NOT ISBLANK(__MEASURE_VALUE), __MEASURE_VALUE - __BASELINE_VALUE)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.