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
o59393
Post Prodigy
Post Prodigy

How to obtain the max value and its capacity

hi all

 

I am trying to obtain in a measure the capacity value where its demand is the max.

 

In the following example, the value that should return the measure should be the one from december (857,793) since the max demand is in december.

 

dsfdsdsfd.JPG

 

How can I obtain the value for the capacity meeting the above condition?

 

I already have the demand:

 

Max demand = MAXX(VALUES('Master Table Month'[Month]),[% of sales by line what if rolling])

 

https://1drv.ms/u/s!ApgeWwGTKtFdhyEaO7IZgUhf2Q-l?e=7mruzM

 

Thanks all.

1 ACCEPTED SOLUTION

Hi @o59393 ,

You can create a measure as below:

_maxCapacity =
VAR _maxMonth =
    CALCULATE (
        MAX ( 'Append1 % of total country demand produced in line'[Month] ),
        FILTER (
            ALL ( 'Append1 % of total country demand produced in line' ),
            [% of sales by line what if rolling] = [Max demand]
        )
    )
RETURN
    CALCULATE (
        [Capacity Measure],
        FILTER (
            ALL ( 'Append1 Balance your lines'[Append1 % of total country demand produced in line.Month] ),
            'Append1 Balance your lines'[Append1 % of total country demand produced in line.Month] = _maxMonth
        )
    )

the max value and its capacity.JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@o59393 , Try like

Max =
var _max =calculate(maxx(values(Table[Month]),[demand UC]),allexcept(Table[Month]))
return
calculate([demand UC], filter(Table, Table[Month] =_max))

Hi @amitchandak 

 

We are getting closer, I guess I understand the logic.

 

the var _max is for returning the month whose demand has a max. In this case it should retain "december"

 

The return should calculate the capacity (in this case it's called "capacity measure") when the month matches the var max: december for this example.

 

I tried this:

 

 

 

Max = 
var _max =calculate(maxx(values('Append1 Balance your lines'[Month]),[% of sales by line what if rolling]))
return
calculate([Capacity Measure], filter('Append1 Balance your lines', 'Append1 Balance your lines'[Month] =_max))

 

 

 

I am getting an empty result. Can you please advise how to fix it?

 

thanks!

Hi @o59393 ,

You can create a measure as below:

_maxCapacity =
VAR _maxMonth =
    CALCULATE (
        MAX ( 'Append1 % of total country demand produced in line'[Month] ),
        FILTER (
            ALL ( 'Append1 % of total country demand produced in line' ),
            [% of sales by line what if rolling] = [Max demand]
        )
    )
RETURN
    CALCULATE (
        [Capacity Measure],
        FILTER (
            ALL ( 'Append1 Balance your lines'[Append1 % of total country demand produced in line.Month] ),
            'Append1 Balance your lines'[Append1 % of total country demand produced in line.Month] = _maxMonth
        )
    )

the max value and its capacity.JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yiruan-msft  Awesome!

 

Thanks 🙂

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.