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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Recognizing Inconsistent value with Date Changes

@Greg_Deckler you might be able to assist with this one. By the way, the solution you created for the previous questions was phenominal.

 

I have a column that recognizes if there is a discrepency between value in the "Pricing Unit" column by looking at the "Unique Contract/Material/Vendor" colunmn. For instance, Contract 5994393 has an error with Material 20's Pricing Unit. Under this Contract's Material 20, the Pricing Unit shows as both 1000 and 1 and generates a "2" in the Pricing Error column. However, looking at the Contract Start / Contract End columns you can see that the error was corrected on 1/13/2020. This was an error from 1/1/2020 - 1/12/2020 but was caught, and corrected; now the date ranges are 1/13/2020-12/31/9999 for the corrected entry. A column needs to show that this error has been corrected.

 

Similarly, Contract 47389 has a pricing unit that is inconsistent that hasn't been caught yet. The Contract End date goes to Year 9999 and the Pricing unit is inconsistent. A column needs to show that this is an error that has not yet been corrected.

 

Unique Contract/Material/VendorContractMaterialVendorPricing UnitMeasureContract StartContract EndPricing Unit Error Formula (>1 = Error)
5994393_20_Brick International599439320Brick International1CAS1/13/202012/31/99992
5994393_20_Brick International599439320Brick International1CAS11/20/201912/31/20192
5994393_20_Brick International599439320Brick International1000CAS1/1/20201/12/20202
47389_10_Wood Supplier4738910Wood Supplier1Per1/1/201912/31/20192
47389_10_Wood Supplier4738910Wood Supplier100Per1/1/202012/31/99992
5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

Based on your description, you may create a measure as below.

 

Result = 
var _ID = SELECTEDVALUE('Table'[Contract])
var _Ifhaserror = 
CALCULATE(
    DISTINCTCOUNT('Table'[Pricing Unit]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Contract] = _ID
    )
)

var _start = 
CALCULATE(
    SUM('Table'[Pricing Unit]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Contract Start] = 
        CALCULATE(
            MIN('Table'[Contract Start]),
            FILTER(
                ALL('Table'),
                'Table'[Contract] = _ID
            )
        )
    )
)

var _end = 
CALCULATE(
    SUM('Table'[Pricing Unit]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Contract Start] = 
        CALCULATE(
            MAX('Table'[Contract Start]),
            FILTER(
                ALL('Table'),
                'Table'[Contract] = _ID
            )
        )
    )
)

return
IF(
    _Ifhaserror=1,
    "no error",
    IF(
        _Ifhaserror>1&&_start=_end,
        "this error has been corrected",
        IF(
            _Ifhaserror>1&&_start<>_end,
            "an error has not yet been corrected"
        )
    )
)

 

 

Result:

c1.png

 

Best Regards

Allan

 

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

 

 

Anonymous
Not applicable

@v-alq-msft Thanks for the assistance! This is catching errors and non-errors but I am receiving false positives when it comes to errors that have been corrected.  In the measure, why did you focus on Contract Start and not Contract End? Within Contract End, if the year is 9999 then I know that this is the current/present price being shown (doesn't mean it's correct). Also, the Contract Start date, once corrected, will never be the date as before (formula line: Ifhaserror.1&&_start=_end). It will be the very next day.

 

I have switched every instance of 'Table'[Contract] with 'Table'[Unique Contract/Material/Vendor] as it zeros in on what exactly needs to match up. 

 

Hi, @Anonymous 

 

Please try to use the following measure to see if it can help.

 

Result = 
var _ID = SELECTEDVALUE('Table'[Unique Contract/Material/Vendor])
var _Ifhaserror = 
CALCULATE(
    DISTINCTCOUNT('Table'[Pricing Unit]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Unique Contract/Material/Vendor] = _ID
    )
)

var _start = 
CALCULATE(
    SUM('Table'[Pricing Unit]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Unique Contract/Material/Vendor]=_ID&&
        'Table'[Contract End] = 
        CALCULATE(
            MIN('Table'[Contract End]),
            FILTER(
                ALL('Table'),
                'Table'[Unique Contract/Material/Vendor] = _ID
            )
        )
    )
)

var _end = 
CALCULATE(
    SUM('Table'[Pricing Unit]),
    FILTER(
        ALLSELECTED('Table'),
        'Table'[Unique Contract/Material/Vendor]=_ID&&
        'Table'[Contract End] = 
        CALCULATE(
            MAX('Table'[Contract End]),
            FILTER(
                ALL('Table'),
                'Table'[Unique Contract/Material/Vendor] = _ID
            )
        )
    )
)

return
IF(
    _Ifhaserror=1,
    "no error",
    IF(
        _Ifhaserror>1&&_start=_end,
        "this error has been corrected",
        IF(
            _Ifhaserror>1&&_start<>_end,
            "an error has not yet been corrected"
        )
    )
)

 

 

Result:

a1.png

 

Best Regards

Allan

 

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

Anonymous
Not applicable

@v-alq-msft This has been a great help and is providing me with a great deal of insight. However, I have struggling to put this information in any useful graph or visual. Even though I can display the formula result sin a column, it doesn't act as one....meaning, I can't create a slicer off the returned values, bar charts, etc.

 

I have tried changing the formula to be recognized either as a "custom column" so it can be used in the above manner, but with no luck.

 

Is there a way to adapt the above solution into a "Custom Column" or in such a way that the results can be dis[played visually? 

Hi, @Anonymous 

 

There may be a way to create a custom column to achieve your requirement. Unfortunately I am not good at Power Query. I hope someone else could help you.

 

Best Regards

Allan

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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