>> Download the sample (Power BI)
This sample creates a dynamic heading for a DAX visualisation, for example to show the highest sales made over a particular time period.
Dashboard - Snippet
Section titled “Dashboard - Snippet”
Data Model - Snippet
Section titled “Data Model - Snippet”
Measures - Sales
Section titled “Measures - Sales”Highest Month Sales
Section titled “Highest Month Sales”Highest Month Sales =MAXX ( VALUES ( Calendar_Table[Month & Year] ), [SUMX Total Sales] )Highest Month Text
Section titled “Highest Month Text”Highest Month Text ="The Highest Sale Month in the selected date context is " & FORMAT ( [Highest Month Sales], "$0,000" )Last Sale Period
Section titled “Last Sale Period”Last Sale Period =VAR LastSale = CALCULATE ( MAX ( Sales_Table[Date] ), ALLSELECTED ( Sales_Table ) )RETURN IF ( DATE ( YEAR ( LastSale ), MONTH ( LastSale ), 1 ) = DATE ( YEAR ( MAX ( Calendar_Table[Date] ) ), MONTH ( MAX ( Calendar_Table[Date] ) ), 1 ), 1, 0 )SUMX Total Sales
Section titled “SUMX Total Sales”SUMX Total Sales =SUMX ( Sales_Table, Sales_Table[Quantity] * Sales_Table[Unit Price] )Tables
Section titled “Tables”Calendar_Table
Section titled “Calendar_Table”Calendar_Table =GENERATE ( CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2019, 12, 31 ) ), VAR currentDay = [Date] VAR Day = DAY ( currentDay ) VAR Month = MONTH ( currentDay ) VAR Year = YEAR ( currentDay ) RETURN ROW ( "Day", day, "Month", month, "Year", year ))