Daily DAX : Day 162 MIN

 The MIN function in Power BI's Data Analysis Expressions (DAX) language is used to return the smallest value in a column or between two expressions. It’s a simple yet powerful aggregation function that helps you analyze data by identifying the minimum value in a dataset, which can be useful for reporting, comparisons, or calculations.

Syntax


MIN(<column>)


OR


MIN(<expression1>, <expression2>)


    <column>: A reference to a column containing numeric, date, or time values. The function evaluates all the values in this column and returns the smallest one.

    <expression1>, <expression2>: Two expressions (e.g., calculations or scalar values) that return numeric, date, or time results. The function compares these two and returns the smaller value.


Return Value


    A single scalar value (numeric, date, or time) representing the minimum.

    If the column or expressions contain blank values, MIN ignores them unless all values are blank, in which case it returns blank.


Use Cases


    Finding the Lowest Value in a Dataset

    You can use MIN to identify the smallest value in a column, such as the lowest sales amount, earliest date, or minimum temperature.

    Example:

    Suppose you have a table Sales with a column Revenue. To find the smallest revenue:  


    MinRevenue = MIN(Sales[Revenue])


    This could be used in a report to show the worst-performing sales figure.

    Comparing Two Values

    When you need to compare two calculated or static values, MIN can determine the smaller one.

    Example:  


    SmallerValue = MIN(100, [TotalSales])


    Here, [TotalSales] might be a measure (e.g., SUM(Sales[Revenue])), and the function returns the smaller of 100 or the total sales.

    Conditional Analysis with Measures

    MIN is often combined with other DAX functions like CALCULATE to find minimum values under specific conditions.

    Example:  


    MinSalesIn2023 = CALCULATE(MIN(Sales[Revenue]), 'Sales'[Year] = 2023)


    This finds the smallest revenue value for the year 2023.

    Working with Dates

    MIN can identify the earliest date in a column, which is handy for timelines or tracking the start of events.

    Example:  


    FirstOrderDate = MIN(Orders[OrderDate])


    Dynamic Thresholds

    You might use MIN to set a baseline or threshold, such as capping a value at a minimum limit.

    Example:  


    AdjustedValue = MIN([ProjectedSales], 500)


    This ensures the result never exceeds 500, useful for budgeting or forecasting.


Practical Example in Power BI

Imagine a dataset with sales data:

Product        Revenue        

Laptop           1200            

Phone            800

Tablet            600


    Create a measure:  


    LowestRevenue = MIN(Sales[Revenue])


    Result: 600 (the smallest revenue value).

    You could display this in a card visual to highlight the lowest sales figure for analysis.


Notes


    MIN works with numeric, date, and time data types but not text (use MINA for text-compatible scenarios, though it treats text as 0).

    It’s different from MINX, which evaluates an expression for each row in a table and finds the minimum result.


In summary, the MIN function is a versatile tool in DAX for pinpointing the smallest value in a column or between two expressions, making it essential for summarizing data and driving insights in Power BI reports.

Comments

Popular posts from this blog

Daily DAX : Day 65 INFO.TABLEPERMISSIONS

Daily DAX : Day 55 PV