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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Calculate difference bet values ie values from current month and previous month

Hi 

 

How can I calculate diiff bet values from current & previous month and apply conditional formatting if the diff is -ve should be colored red ive created columns for month and displaying values by region

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Try to create a measure.

bet = 
var _curr=CALCULATE(SUM([Value]),FILTER(ALL('Table'),EOMONTH([Date],0)=EOMONTH(MAX([Date]),0)))
var _previous=CALCULATE(SUM([Value]),FILTER(ALL('Table'),EOMONTH([Date],0)=EOMONTH(MAX([Date]),-1)))
return _curr-_previous

Then apply it conditional format.

vyalanwumsft_1-1648432914008.png

 

vyalanwumsft_0-1648432892272.png

The final output is shown below:

vyalanwumsft_2-1648432932859.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Try to create a measure.

bet = 
var _curr=CALCULATE(SUM([Value]),FILTER(ALL('Table'),EOMONTH([Date],0)=EOMONTH(MAX([Date]),0)))
var _previous=CALCULATE(SUM([Value]),FILTER(ALL('Table'),EOMONTH([Date],0)=EOMONTH(MAX([Date]),-1)))
return _curr-_previous

Then apply it conditional format.

vyalanwumsft_1-1648432914008.png

 

vyalanwumsft_0-1648432892272.png

The final output is shown below:

vyalanwumsft_2-1648432932859.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Create a color measure like

 

Arrow color =
var _change =[MTD Sales]-[Last MTD Sales]
return
SWITCH (
TRUE(),
_change > 0, "green",
_change = 0, "blue",
_change < 0, "red"
)

 

where we have , measure like these using TI and date table

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
next month Sales = CALCULATE(SUM(Sales[Sales Amount]),nextmonth('Date'[Date]))
this month = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH('Date'[Date])))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
previous month value = CALCULATE(sum('Table'[total hours value]),previousmonth('Date'[Date]))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.