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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Arnault_
Resolver III
Resolver III

MIN value / Virtual table

Hi All,

Here is my problem.

I have a simple table with transactions with different supply centers and different prices.

I have created a table where I have the 3 supply centers and the average price for each of them.

Now I would like to display the minimum value amongst the three "average prices".

The difficulty is that the MIN value should be obtained by iterating through the 3 average prices. In the report visual (table), I would like to see what is shown in the below picture. The second column is a simple average and the third one corresponds to the MIN of the second one.

Here is a pbix file.

Here is the expected result.

2022-09-20_15h26_00.png

 

Thanks in advance for your help.

 

3 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Price (Average) - MIN All Supply Center v2 = 
MINX (
    CALCULATETABLE(
        ADDCOLUMNS ( VALUES ( Data[supply_center] ), "Price", [Price (Average)] ),
        REMOVEFILTERS(Data)
    ),
    [Price]
)

View solution in original post

PabloDeheza
Solution Sage
Solution Sage

Hi there!

Try this!

Price (Average) - MIN All Supply Center v3 = 
VAR _Value =
MINX (
    ALL ( Data[supply_center] ),
    CALCULATE( AVERAGE( Data[unit_price] ) )
)
RETURN
IF( 
    HASONEVALUE( Data[supply_center] ),
    _Value,
    BLANK()
)

Should return the following:

PabloDeheza_0-1663681915252.png

Let me know if that helps!

 

View solution in original post

Arnault_
Resolver III
Resolver III

I finally found the solution myslef.

Price (Average) MIN v3 = 
CALCULATE ( MINX
     ( VALUES ( Data[supply_center] ) ,
    [Price (Average)]
), ALL (Data[supply_center] )
)

View solution in original post

7 REPLIES 7
Arnault_
Resolver III
Resolver III

Thanks @Greg_Deckler , I will take a look.

Cheers

Arnault_
Resolver III
Resolver III

I finally found the solution myslef.

Price (Average) MIN v3 = 
CALCULATE ( MINX
     ( VALUES ( Data[supply_center] ) ,
    [Price (Average)]
), ALL (Data[supply_center] )
)
PabloDeheza
Solution Sage
Solution Sage

Hi there!

Try this!

Price (Average) - MIN All Supply Center v3 = 
VAR _Value =
MINX (
    ALL ( Data[supply_center] ),
    CALCULATE( AVERAGE( Data[unit_price] ) )
)
RETURN
IF( 
    HASONEVALUE( Data[supply_center] ),
    _Value,
    BLANK()
)

Should return the following:

PabloDeheza_0-1663681915252.png

Let me know if that helps!

 

That's a good solution except that the end of the code can be removed in my scenario. thanks for your input !!!

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but I tried to fix the measure like below.

Please check the below and the attached pbix file whether it suits your requirement.

 

Price (Average) =
IF (
    HASONEVALUE ( Data[supply_center] ),
    AVERAGE ( Data[unit_price] ),
    MINX (
        ADDCOLUMNS (
            VALUES ( Data[supply_center] ),
            "Price", CALCULATE ( AVERAGE ( Data[unit_price] ) )
        ),
        [Price]
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
johnt75
Super User
Super User

Price (Average) - MIN All Supply Center v2 = 
MINX (
    CALCULATETABLE(
        ADDCOLUMNS ( VALUES ( Data[supply_center] ), "Price", [Price (Average)] ),
        REMOVEFILTERS(Data)
    ),
    [Price]
)
Greg_Deckler
Community Champion
Community Champion

@Arnault_ This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors