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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
badger123
Resolver I
Resolver I

Max of Summed Values of a Category

Hello,

 

I am hoping for some help with the following, after trying and failing numerous times. I have created two dummy tables for simplicity (see below). These tables have a one-to-many relationship based on the ID.

 

I am creating a page in my report that focuses on one Item in one Country at a time. There are various slicers, including Region. I am looking to create some benchmarks to compare the selected Item with its Category benchmarks. The benchmark I am struggling to create is the Max total Volume per Category, let's call this MaxBenchmark.

 

This is how I want it to work. If I select Item 1 and Country UK, total Volume would be 350 and MaxBenchmark should be 2,300 because Item 3 has the highest total Volume in Category A. If I select Item 2 and Country UK, total Volume would be 850, and MaxBenchmark should also be 850 because Item 2 has the highest total vol in Category B. An added complication, if I now select Region UKE, total Volume would be 50 and MaxBenchmark should be 100, because Item 4 has the highest Volume per Category in that Region. 

 

Table1Table1Table2Table2

I have been going round in circles with this for days so any guidance would be much appreciated! 

 

Thanks 🙂

 

 

 

2 ACCEPTED SOLUTIONS

Hi @badger123

 



We'll create the two measures you talk about and the you can use them as you like in the gauge.

1. Set the Table2[ID] and Table1[Country] and Table1[Region] in slicers as you described
2. Create the measure for the selected item volume (which I believe you have already):
 

VolumeMeasure = SUM(Table1[ID])

3. Create the measure for the Max:

MaxBenchmark =
VAR _ItemCategory =
    SELECTEDVALUE ( Table2[Category] )
VAR _CategoryVolumes =
    ADDCOLUMNS (
        CALCULATETABLE (
            VALUES ( Table2[ID] );
            Table2[Category] = _ItemCategory;
            ALL ( Table2 )
        );
        "VolumeCol"; [VolumeMeasure]
    )
VAR _MaxInCat =
    MAXX ( _CategoryVolumes; [VolumeCol] )
RETURN
    _MaxInCat

Code formatted with   www.daxformatter.com

View solution in original post

@badger123

 

I guess you've done stg different from what I described. It's working on my end. Have a look at this file.

View solution in original post

12 REPLIES 12

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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