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
GeekAlfPro
Resolver II
Resolver II

Measure minimum by day

Hi,

 

i've a sum of kms in a table, for each day of the month.

GeekAlfPro_0-1676387532792.png

i'd like to get the min and the max by day of the month.

For example for the day 1 

Max = 2902

Min = 192

For day 5

Max = 2721

Min = 1481

 

Do i Need a calculated table or a measure ?

How can i do ?

1 ACCEPTED SOLUTION
GeekAlfPro
Resolver II
Resolver II

Hello,

 

I managed to build the calculate table, and slightly modified the measure.

As i want the min by day of the month, the final code of my measure is

 

@Min Kms Jour = 
var _table = CALCULATETABLE(
    ADDCOLUMNS(
        SUMMARIZE(
            'Date',
            'Date'[Jour Numéro],
            'Date'[Année Mois]
        ),
        "Kms Electric",[Somme Kms Electric]
    ),
    ALLSELECTED('Date'[Année Mois]) //and not ALLSELECTED('Date'[Jour Numéro])
)
var _min = 
MINX(_table, [Somme Kms Electric])
return
_min

 

Thanks again @v-cgao-msft 

View solution in original post

3 REPLIES 3
GeekAlfPro
Resolver II
Resolver II

Hello,

 

I managed to build the calculate table, and slightly modified the measure.

As i want the min by day of the month, the final code of my measure is

 

@Min Kms Jour = 
var _table = CALCULATETABLE(
    ADDCOLUMNS(
        SUMMARIZE(
            'Date',
            'Date'[Jour Numéro],
            'Date'[Année Mois]
        ),
        "Kms Electric",[Somme Kms Electric]
    ),
    ALLSELECTED('Date'[Année Mois]) //and not ALLSELECTED('Date'[Jour Numéro])
)
var _min = 
MINX(_table, [Somme Kms Electric])
return
_min

 

Thanks again @v-cgao-msft 

v-cgao-msft
Community Support
Community Support

Hi @GeekAlfPro ,

 

You need an unconnected entry table and three measure.

Table.

vcgaomsft_1-1676445594135.png

Measures:

@MIN = 
VAR _table = 
CALCULATETABLE(
    ADDCOLUMNS(
        SUMMARIZE(
            'Calendar',
            'Calendar'[YearMonthSort],
            'Calendar'[Day]
        ),
        "MeasureSales",[@Sales]
    ),
    ALLSELECTED('Calendar'[YearMonthSort])
)
VAR _min = MINX(_table,[MeasureSales])
RETURN
_min
@MAX = 
VAR _table = 
CALCULATETABLE(
    ADDCOLUMNS(
        SUMMARIZE(
            'Calendar',
            'Calendar'[YearMonthSort],
            'Calendar'[Day]
        ),
        "MeasureSales",[@Sales]
    ),
    ALLSELECTED('Calendar'[YearMonthSort])
)
VAR _max = MAXX(_table,[MeasureSales])
RETURN
_max
@MAX&MIN = 
SWITCH(
    SELECTEDVALUE('Table'[Value]),
    "MAX",[@MAX],
    "MIN",[@MIN]
)

vcgaomsft_0-1676445567903.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Thanks a lot @v-cgao-msft 

i will try and let you know the result.

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.