Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
scorrera
Regular Visitor

DAX Help

Hello,

 

I have a table that shows spending for different center-accounts across time. It looks like this:

 

scorrera_0-1713378594892.png

 

The Actual Spend column is a calculated column. I also calculated as a measure.

 

I would like to have a visual that shows the top 20 center-accounts with the biggest change in spend from month to month. So center-account 1234 it would take 25-90= -65 and if that was one of the top center-accounts for change it would list it in a visual with what the change was. Ideally I'd like to be able to pick a past month, say from 5 months ago, and have this still work but I would take it if it only worked for the latest month and its previous month. I would also like for it to show top 20 biggest change positive and negative.

 

Thanks in advance,

Steve

1 ACCEPTED SOLUTION
K0da
New Member

Hi,

 

For what i understood you need the difference from last day of the month and first day of the month, for each month, for the column [Actual Spending].

 

So, i created two colums, Month_Year, and Amplitude, it goes like this

 

Month_Year = MONTH(Plan1[Calendar Date]) & "/" & YEAR(Plan1[Calendar Date])

 

 

 

Amplitude = 
VAR SPENDING_LAST_DAY = CALCULATE(
    SUM(Plan1[Actual Spending]),
    FILTER(
    ALL(Plan1),
        EARLIER(Plan1[Center-Account]) = Plan1[Center-Account] && EARLIER(Plan1[Month_Year]) = Plan1[Month_Year] && ENDOFMONTH(Plan1[Calendar Date]) = Plan1[Calendar Date]
    )
)

VAR SPENDING_FIRST_DAY = CALCULATE(
    SUM(Plan1[Actual Spending]),
    FILTER(
    ALL(Plan1),
        EARLIER(Plan1[Center-Account]) = Plan1[Center-Account] && EARLIER(Plan1[Month_Year]) = Plan1[Month_Year] && STARTOFMONTH(Plan1[Calendar Date]) = Plan1[Calendar Date]
    )
)

RETURN SPENDING_LAST_DAY-SPENDING_FIRST_DAY

 

 

The result Captura de tela 2024-04-17 173855.png

 

with this column you can do all of the other things like a top 20, and a calendar filter would work in any interval you want.

 

Theres probably a cleaner way to do it but, i hope that helps.

View solution in original post

1 REPLY 1
K0da
New Member

Hi,

 

For what i understood you need the difference from last day of the month and first day of the month, for each month, for the column [Actual Spending].

 

So, i created two colums, Month_Year, and Amplitude, it goes like this

 

Month_Year = MONTH(Plan1[Calendar Date]) & "/" & YEAR(Plan1[Calendar Date])

 

 

 

Amplitude = 
VAR SPENDING_LAST_DAY = CALCULATE(
    SUM(Plan1[Actual Spending]),
    FILTER(
    ALL(Plan1),
        EARLIER(Plan1[Center-Account]) = Plan1[Center-Account] && EARLIER(Plan1[Month_Year]) = Plan1[Month_Year] && ENDOFMONTH(Plan1[Calendar Date]) = Plan1[Calendar Date]
    )
)

VAR SPENDING_FIRST_DAY = CALCULATE(
    SUM(Plan1[Actual Spending]),
    FILTER(
    ALL(Plan1),
        EARLIER(Plan1[Center-Account]) = Plan1[Center-Account] && EARLIER(Plan1[Month_Year]) = Plan1[Month_Year] && STARTOFMONTH(Plan1[Calendar Date]) = Plan1[Calendar Date]
    )
)

RETURN SPENDING_LAST_DAY-SPENDING_FIRST_DAY

 

 

The result Captura de tela 2024-04-17 173855.png

 

with this column you can do all of the other things like a top 20, and a calendar filter would work in any interval you want.

 

Theres probably a cleaner way to do it but, i hope that helps.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.