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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rschaudhr
Resolver II
Resolver II

Quarter over quarter comparision

rschaudhr_0-1678739129495.png

 

I have data as shown above the first column is the unique identifier. There are two column after that which are dates. For each date there is a significance values. So, this is what I want to achieve:

if the significance has not changed over the last period, then it should say "no change" per unique identifier. 

if the significance has changed over the last period, then it should say "change" per unique identifier.

 

Keep in mind there are two dates so far, but we are planning to bring in many dates. There needs to be comparion dates over dates.

 

I hope this makes sense. Please let me know if you have questions. 

 

Thank you

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

Hi @rschaudhr ,

 

Firstly, I think your table should look like as below.

RicoZhou_0-1678953423736.png

If your table looks like as below, I suggest you to try UNPIVOT function to transform your table.

RicoZhou_1-1678953497123.png

Then create a measure and show result in matrix column subtotal field.

Whether change in last period = 
VAR _LASTDATE =
    MAXX ( ALLEXCEPT ( 'Table', 'Table'[Unique Reference] ), 'Table'[Date] )
VAR _PREDATE =
    MAXX (
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Unique Reference] ),
            'Table'[Date] < _LASTDATE
        ),
        'Table'[Date]
    )
VAR _STATUS1 =
    CALCULATE ( MAX ( 'Table'[Status] ), 'Table'[Date] = _LASTDATE )
VAR _STATUS2 =
    CALCULATE ( MAX ( 'Table'[Status] ), 'Table'[Date] = _PREDATE )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Date] ),
        MAX ( 'Table'[Status] ),
        IF ( _STATUS1 = _STATUS2, "no change", "change" )
    )

Result is as below.

RicoZhou_2-1678954037043.png

 

Best Regards,
Rico Zhou

 

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-rzhou-msft
Community Support
Community Support

Hi @rschaudhr ,

 

Firstly, I think your table should look like as below.

RicoZhou_0-1678953423736.png

If your table looks like as below, I suggest you to try UNPIVOT function to transform your table.

RicoZhou_1-1678953497123.png

Then create a measure and show result in matrix column subtotal field.

Whether change in last period = 
VAR _LASTDATE =
    MAXX ( ALLEXCEPT ( 'Table', 'Table'[Unique Reference] ), 'Table'[Date] )
VAR _PREDATE =
    MAXX (
        FILTER (
            ALLEXCEPT ( 'Table', 'Table'[Unique Reference] ),
            'Table'[Date] < _LASTDATE
        ),
        'Table'[Date]
    )
VAR _STATUS1 =
    CALCULATE ( MAX ( 'Table'[Status] ), 'Table'[Date] = _LASTDATE )
VAR _STATUS2 =
    CALCULATE ( MAX ( 'Table'[Status] ), 'Table'[Date] = _PREDATE )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Date] ),
        MAX ( 'Table'[Status] ),
        IF ( _STATUS1 = _STATUS2, "no change", "change" )
    )

Result is as below.

RicoZhou_2-1678954037043.png

 

Best Regards,
Rico Zhou

 

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

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.