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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
joshua1990
Post Prodigy
Post Prodigy

IF Clause on different level of granularity

I have a budget table that shows me the budget for each department:

Year-WeekDepartmentBudget
2021-01Mounting500
2021-02Mounting400

 

And then I have a Sales table that shows me the sales per Article

ArticleYear-WeekSales
A2021-01500
B2021-01400

 

Using an Attribute Table I have also the relation between the article and Department. Both tables are also linked by a calendar table.

What I would like to determine now is the Budget per Department, but if there is no Budget the actual Sales should be represented.

For Instance for department 'ABC' there is no Budget, but Sales. Here the new measure should show the sales. 

In the end I have a matrix that shows me the department on row level and year-Week per column.

How is this possible?

 

IF(ISBLANK(Budget[Budget]), Sales, Budget

 

This will probably not work, right?

I assume I need a SUMX

 

1 REPLY 1
VahidDM
Super User
Super User

Hi @joshua1990 

 

You tables are connected with the calendar table, so there is no connection between Department and Article. My question is Do you want to show the same date sale amount as a department budget? IF yes, try this:

 

Measure =
Var _A = max(Budget[Year-Week])
Var _Sale = calculate(sum(Sales[Sales]),filter(all(Sales),Sales[[Year-Week]=_A))

IF(ISBLANK(Budget[Budget]),_Sale,Budget[Budget])

 

 

Can you share a tables with those connection columns (if that is a Date column)

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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