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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Calculating across columns using IF and variable

Need: based upon a quarter selected in the filter, will calculate nine columns IF that quarter is in any of other nine columns. Details: 1. Project spending can occur 5 quarters prior to project start date, and three quarters after project start date. 2. Database has nine columns for quarter that the spend will occur. spendQtr6 in the database is calculated from project start date, while all other spendQtr columns are calculated from spendQtr6. 3. Database has nine columns for the capital$ spend. Users enter the data using a form. See example below. Problem: 1. In a matrix in Power BI the spend per quarter/year needs to be shown, regardless of which column that quarter/year is located. 2. Is there a code or a function that will look at the quarter/year columns and IF it matches a variable (based upon filter), calculate the capital columns that are associated with that quarter/year? 3. The quarter/year headings are a multi row card, which uses a variable to populate. Can that variable be used in a calculation or other script to populate the capital spending part of the matrix? Please give me some examples.
1 REPLY 1
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Could you please share sample data and clarify more details about your requirement.

 

Regards,

Jimmy Tao

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.