Finding the lowest value and highlighting in DAX
We have the Sale date and in that, we want to show the month-wise revenue in that the client wants to see the lowes revenue of the month in each year for that we want to write a DAX function
Step 1:
Write a calculated table to get the Dates from the CalenderAuto() function also from the date function we need
Month =Calendar[date].[Month]
Step 2:
Get the Total Revenue in the measure
Total Revenue = Sum(SalesTable[Revenue])
Step 3:
Write the following DAX function
Lowest Monthly Revanue =
var _MonthlyRevanue =
CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE(Calender,Calender[month]),
“@Revanue”,[Total Revenue]
),ALLSELECTED()
)
Var _minRevanue =
MINX(_MonthlyRevanue,[@Revanue])
var _CurrentRevanue = [Total Revenue]
Var _result = If(_minRevanue = _CurrentRevanue,”Red”,”Green”)
return
_result
Step 4 :
In the bar chart month as an axis and value as a revenue
The format the bar chat and then convert the data colour to function and select the measure you created
Now the bar chart will be shown the lowest revenue in red
Follow us for more such topics and suggestions.Also, click the link below to follow us in LinkedIn https://www.linkedin.com/showcase/sphyzee-analytics/about/