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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Creating Arrows to trend values over a certain period of time

Good Morning. So i have a PBI dashboard I created (very amature) and I need some help. 

 

Vlynnpar01_0-1676913609980.png

I need to show wheather the value is up or down from the previous month. I know how to add the arrows with conditional formatting, the issue I'm running into is the calculation. I used a previous dashboard as a guide, but the formula to calculate the difference Month over month is not right. Does anyone have the syntax or guidence for how to write this so it work. Right now i currently have a measure created :

 

 

 

"

%_Count_Mom_Var = IF(CALCULATE(SUM('Carc_Rarc_Historical'[Patnum]),ALL(Dates[Date_Id]),FILTER(ALL(Dates),Dates[Date_Rank]=SELECTEDVALUE(Dates[Date_Rank])-1))=0,"", (CALCULATE(SUM('Carc_Rarc_Historical'[Patnum]))-CALCULATE(SUM('Carc_Rarc_Historical'[Patnum]),ALL(Dates[Date_Id]),FILTER(ALL(Dates),Dates[Date_Rank]=SELECTEDVALUE(Dates[Date_Rank])-1)))/CALCULATE(SUM('Carc_Rarc_Historical'[Patnum]),ALL(Dates[Date_Id]),FILTER(ALL(Dates),Dates[Date_Rank]=SELECTEDVALUE(Dates[Date_Rank])-1)))" 
 
 
and it is calculating zero for every field, so i know its wrong. I just don't know how to fix it. 
 
 
or if there is an easier way to go about this, I'd appreciate the help
1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

%_Count_Mom_Var = 
IF (
    CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] ),
        FILTER ( ALL ( Dates ),
            Dates[Date_Rank] = SELECTEDVALUE ( Dates[Date_Rank] ) - 1
        )
    ) = 0,
    "",
    CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] )
            - CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] ),
                FILTER ( ALL ( Dates ),
                    Dates[Date_Rank] = SELECTEDVALUE ( Dates[Date_Rank] ) - 1
                )
            )
    )
        / CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] ),
            FILTER ( ALL ( Dates ),
                Dates[Date_Rank] = SELECTEDVALUE ( Dates[Date_Rank] ) - 1
            )
        )
)

vzhangti_0-1677050917962.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

%_Count_Mom_Var = 
IF (
    CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] ),
        FILTER ( ALL ( Dates ),
            Dates[Date_Rank] = SELECTEDVALUE ( Dates[Date_Rank] ) - 1
        )
    ) = 0,
    "",
    CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] )
            - CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] ),
                FILTER ( ALL ( Dates ),
                    Dates[Date_Rank] = SELECTEDVALUE ( Dates[Date_Rank] ) - 1
                )
            )
    )
        / CALCULATE ( SUM ( 'Carc_Rarc_Historical'[Patnum] ),
            FILTER ( ALL ( Dates ),
                Dates[Date_Rank] = SELECTEDVALUE ( Dates[Date_Rank] ) - 1
            )
        )
)

vzhangti_0-1677050917962.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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