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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register 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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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