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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

GROUPBY or CALCULATE or new table?

Hi PowerBI community,

 

I hope all of you are safe in these challenging times.

 

I have a problem which I'm not able to solve as I can't figure out what the right approach is. I have a dataset with columns that have been unpivoted (for a good reason) but that lay the information out in the wrong format for one particular calculation I'm trying to run. An example of the current table is as follows (important to note that the approved budget is actually for whole year but when unpivoted is showed for each line)

 

ProgramProjectDateApproved Budget
Program 1Proj A01-Jan-202020
Program 1Proj A01-Feb-202020
Program 1Proj A01-Mar-202020
Program 1Proj B01-Jan-202010
Program 1Proj B01-Feb-202010
Program 2Proj D01-Jan-202050
Program 2Proj D01-Feb-202050

 

The output I'm seeking through a magic measure would be (with the ability to have slicers on Program and Project or also do add different layers in the table and have the calculation done at the project level):

 

ProgramApproved Budget
Program 130
Program 250

 

Thanks in advance for any suggestions 🙂

OF

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous 

Create a new measure like

sumx(summarize(table, table[Program],table[Project], "_max",max(Approved Budget)),[_max])

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous 

Create a new measure like

sumx(summarize(table, table[Program],table[Project], "_max",max(Approved Budget)),[_max])

 

Anonymous
Not applicable

Thanks very much, it's perfect 🙂

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.