Forum Discussion
Need Help with Dax
- 3 years ago
You can use a DAX pattern like this to return your max month in a card visual. Update it with your actual table, column, and measure names.
MaxMonth = VAR vSummary = ADDCOLUMNS ( ALLSELECTED ( 'Date'[YearMonthShort] ), "cQty", [Total Qty] ) VAR vTop1 = TOPN ( 1, vSummary, [cQty], DESC ) RETURN MAXX ( vTop1, 'Date'[YearMonthShort] )Pat
Hi mjanecek ,
I tried to replicate your usecase. Please find a suggestion below.
My data model
Formula Average
Average | Value = AVERAGE('Fact_Sales'[Values])
Formula Monthly Min Period
Iterator | Period with Min Value =
var _current = [Average | Value]
var _MonthlyMinValue =
CALCULATE(
MINX(
VALUES(DimDate[MonthWithYear]),
CALCULATE([Average | Value])
),
ALLSELECTED(DimDate)
)
Return
IF(_current=_MonthlyMinValue,SELECTEDVALUE(DimDate[MonthWithYear]))
Result
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
- mjanecek3 years agoHelper I
Hi: This works great when there is a month on a visual, but when I try to put it into a scorecard, I get no value. How would I adapt the measure to allow the max month and year to display in a scorecard that did not have the month and year in the filter context.