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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
henryhuynhpham
New Member

Month to Month Difference

I am doing a dashboard showing percentage score of each month for different elements. I am stuck at adding a comparision/different from this month to the previous month. For example, August's overall is 45% and July's overall is 40% and I want to show the 5% different in the Card or Bar Chart Visualization. Also, is it possible to make an up or down arrow to indicate that instead of the minus sign?

henryhuynhpham_0-1698170849013.png

 

1 ACCEPTED SOLUTION

This is because Month column data type is not a date.
You can try to change the Month column data type to Date in transform data option.
Right click on the table particular table in Data section > go to edit query
Select the month column
Go to Transform tab in the top menu.
change Data Type to “Date"

PBI_change_date_type.jpg

 

Once change it, Click on File > Close and Apply


After that try to create the measure.

View solution in original post

5 REPLIES 5
Nilupul
Frequent Visitor

You can use below query to indicate negative values with down arrow key, positive value with up arrow key

Overall Score Diffrence = 
VAR _CurrentMonthScore =
    SUM ( 'Table'[Score] )
VAR _PrevMonthScore =
    CALCULATE ( SUM ( 'Table'[Score] ), PREVIOUSMONTH ( 'Table'[Month] ) )

VAR Diff = _CurrentMonthScore - _PrevMonthScore

RETURN
    IF (
        Diff < 0,
        CONCATENATE ( UNICHAR ( 9660 ), FORMAT ( ABS ( Diff ), "Percent" ) ),
        CONCATENATE ( UNICHAR ( 9650 ), FORMAT ( Diff, "Percent" ) )
    )

 

Additionally, You can use conditional formatting for values like below to show negative values with another color ( ▼ )

conditional formatting for  callout valueconditional formatting for callout value

 

Nilupul
Frequent Visitor

You can try below measure to calculate the diffrence between months.

 

Overall Score Diffrence = 
VAR _CurrentMonthScore = SUM('Table'[Score])
VAR _PrevMonthScore =
CALCULATE(SUM('Table'[Score]),PREVIOUSMONTH('Table'[Month]))

RETURN
_CurrentMonthScore - _PrevMonthScore

 

 

It gave me this error.

henryhuynhpham_0-1698179643707.png

 

This is because Month column data type is not a date.
You can try to change the Month column data type to Date in transform data option.
Right click on the table particular table in Data section > go to edit query
Select the month column
Go to Transform tab in the top menu.
change Data Type to “Date"

PBI_change_date_type.jpg

 

Once change it, Click on File > Close and Apply


After that try to create the measure.

Thank you for the formula!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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