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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Alex_19992
Frequent Visitor

Measure that sums based on the values of certain columns

Hi, 

Sorry if I put this at the wrong place, or something is unclear, I'm a newbie. 

I also couldn't find a similar problem unfortunately. 

 

Problem explanation: 

I am trying to write a measure that will return the sum of certain values based on two columns. 

Below you can see how the data is formatted. In this dataset there are two (but could later be more) unique references, I want to sum the cost of the highest recommendations (based on the number in that cell: "recommendation 3:"). So it would take just one value per reference to sum. In this case the measure should sum the 1000 and the 1500 since they respectively have the highest recommendation number of this dataset. 

 

I tried adding a calculated column with just the recommendation number and then running the calculation with that. But I couldn't figure out how to make a measure that sum's based on these two conditions. (I did this within the power query by copying that column to create a new column and slicing it so i only keep the number). Unfortunately also with this I couldn't make it to work. 

 

Curious if this is possible and how I could approach this best, I am looking forward to your feedback!

 

Thanks a lot in advance and let me know if something is unclear 😉 

 

Some sample data to visualize it: 

 

ReferenceRecommendationscost
1404BC_20_recommendation 1: lorem itsem500
1404BC_20_recommendation 2: lorem itsem850
1404BC_20_recommendation 3: lorem itsem1000
6308EC_24_recommendation 1: lorem itsem400
6308EC_24_recommendation 2: lorem itsem900
6308EC_24_recommendation 3: lorem itsem1100
6308EC_24_recommendation 4: lorem itsem1500
1 ACCEPTED SOLUTION
vapid128
Solution Specialist
Solution Specialist

sumx(values([Reference),calculate(max[cost)) = 1500+1000=2500

View solution in original post

2 REPLIES 2
Alex_19992
Frequent Visitor

That was easier than I expected. Thanks a lot! 

vapid128
Solution Specialist
Solution Specialist

sumx(values([Reference),calculate(max[cost)) = 1500+1000=2500

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors