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
Prudhviraj
Frequent Visitor

Dynamic calculation based on Slicer value.

Hi All,

 

We have to create report where user can select Month_Name, based on the selection we have to show selected month and previous month of selected month in the report. And all of that I need to show arrow where I have less % compare to previous month, please look at the below image for clear idea.

 

Could you please help me out on this, would be really appreciable.

 

 

If you look at below example, user selected Feb then it's show Jan and Feb data. If user select Mar, then It has to show Feb and Mar data. 

 

Capture.PNG

 

 

 

 

Thanks,

Prudviraj

1 ACCEPTED SOLUTION
v-caliao-msft
Microsoft Employee
Microsoft Employee

@Prudhviraj,

 

Currently, we cannot achieve this requirement in table. To work around this, we could achieve the similar requirement in table visual.

create a table and some columns.

Table =
FILTER (
    CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2017, 12, 31 ) ),
    DAY ( [Date] ) = 1
)

MonthName =
FORMAT ( 'Table'[Date], "MMMM" )

MonthNumber =
MONTH ( 'Table'[Date] )

Create two measure in your original table.

Filter =
VAR selectmonth =
    IF (
        HASONEFILTER ( 'Table'[MonthName] ),
        MAX ( 'Table'[MonthNumber] ),
        BLANK ()
    )
VAR Previous_month = selectmonth - 1
VAR check =
    IF (
        MAX ( Table1[MonthNumber] ) = selectmonth
            || MAX ( Table1[MonthNumber] ) = Previous_month,
        1,
        0
    )
RETURN
    check
Change =
VAR selectmonth =
    IF (
        HASONEFILTER ( 'Table'[MonthName] ),
        MAX ( 'Table'[MonthNumber] ),
        BLANK ()
    )
VAR Previous_month = selectmonth - 1
VAR currenttype =
    MAX ( Table1[Type] )
VAR currentregion =
    MAX ( Table1[Region] )
VAR currentmonth =
    MAX ( Table1[MonthNumber] )
RETURN
    IF (
        MAX ( 'Table1'[MonthNumber] ) = Previous_month,
        BLANK (),
        IF (
            MAX ( Table1[Amount] )
                - LOOKUPVALUE (
                    Table1[Amount],
                    Table1[Type], currenttype,
                    Table1[Region], currentregion,
                    Table1[MonthNumber], Previous_month
                )
                > 0,
            "increase",
            "decrease"
        )
    )

User Filter measure in you visual filter.
Capture.JPGCapture1.JPGCapture2.JPG

 

Regards,

Charlie Liao

View solution in original post

3 REPLIES 3
v-caliao-msft
Microsoft Employee
Microsoft Employee

@Prudhviraj,

 

Currently, we cannot achieve this requirement in table. To work around this, we could achieve the similar requirement in table visual.

create a table and some columns.

Table =
FILTER (
    CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2017, 12, 31 ) ),
    DAY ( [Date] ) = 1
)

MonthName =
FORMAT ( 'Table'[Date], "MMMM" )

MonthNumber =
MONTH ( 'Table'[Date] )

Create two measure in your original table.

Filter =
VAR selectmonth =
    IF (
        HASONEFILTER ( 'Table'[MonthName] ),
        MAX ( 'Table'[MonthNumber] ),
        BLANK ()
    )
VAR Previous_month = selectmonth - 1
VAR check =
    IF (
        MAX ( Table1[MonthNumber] ) = selectmonth
            || MAX ( Table1[MonthNumber] ) = Previous_month,
        1,
        0
    )
RETURN
    check
Change =
VAR selectmonth =
    IF (
        HASONEFILTER ( 'Table'[MonthName] ),
        MAX ( 'Table'[MonthNumber] ),
        BLANK ()
    )
VAR Previous_month = selectmonth - 1
VAR currenttype =
    MAX ( Table1[Type] )
VAR currentregion =
    MAX ( Table1[Region] )
VAR currentmonth =
    MAX ( Table1[MonthNumber] )
RETURN
    IF (
        MAX ( 'Table1'[MonthNumber] ) = Previous_month,
        BLANK (),
        IF (
            MAX ( Table1[Amount] )
                - LOOKUPVALUE (
                    Table1[Amount],
                    Table1[Type], currenttype,
                    Table1[Region], currentregion,
                    Table1[MonthNumber], Previous_month
                )
                > 0,
            "increase",
            "decrease"
        )
    )

User Filter measure in you visual filter.
Capture.JPGCapture1.JPGCapture2.JPG

 

Regards,

Charlie Liao

Thank you Charlie.

Hi,

 

This can be done in MS Excel using PowerPivot and CUBE functions.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.

Top Solution Authors