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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
amandabus21
Helper V
Helper V

Rule on Column

Hello,

 

I have a Column I created, but I would  like the column to run like: 

 

If "[Equipment.Equipment Level 01.Key]" does not equal the previous "[Equipment.Equipment Level 01.Key], then, Then 0 Else [Mileage] - Previous([Mileage]))

 

 

The column: 

 

Variable Difference =
    VAR curr =
        CALCULATE ( MAX ( 'PM On Time Performance Bus PM-BI-002 (2)'[Mileage]) )
    VAR prev =
        MAXX (
            FILTER (
                'PM On Time Performance Bus PM-BI-002 (2)',
                'PM On Time Performance Bus PM-BI-002 (2)'[Equipment.Equipment Level 01.Key] = EARLIER ( 'PM On Time Performance Bus PM-BI-002 (2)'[Equipment.Equipment Level 01.Key] )
                    && 'PM On Time Performance Bus PM-BI-002 (2)'[Completion Date.Completion Date Level 01] < EARLIER ('PM On Time Performance Bus PM-BI-002 (2)'[Completion Date.Completion Date Level 01] )
            ),
    [Mileage]
        )
    RETURN
        curr - prev

 

6 REPLIES 6
FreemanZ
Super User
Super User

hi @amandabus21 

could you paste some sample data?

Completion Date   Bus #    Mileage    Diff
2/4/2016 0:00 201 18923 18421
3/29/2016 0:00 201 24695 5772
5/18/2016 0:00 201 30781 6086
7/11/2016 0:00 201 36921 6140
8/25/2016 0:00 201 42823 5902
10/24/2016 0:00 201 48794 5971

amandabus21_0-1677194376520.png

 

hi @amandabus21 

could you expand your sample data to include [Equipment.Equipment Level 01.Key]? 

Are [Variable Difference] and [Diff] the same?

@FreemanZ any other things needed?

@FreemanZ 

 

[Equipment.Equipment Level 01.Key] is "Bus" 

 

Sorry forgot I renamed for the visual. Diff is "Variable Difference - 6600"

 

C

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.