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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Sachy123
Helper V
Helper V

Calculated Column - flag

So my Data is in the following format.

 

 

ReportDateUpdateDateColumn AColumn B
31st December 202020/12/2020 8:00:001080
31st December 202015/12/2020 10:30:008800
31st December 202001/12/2020 8:00:004432
30th November 202029/11/2020 10:30:009099
30th November 202026/11/2020 14:00:334467
30th November 202015/11/2020 15:00:445020

 

I need to add one CALCULATED COLUMN, say FLAG, which becomes 1 when it encounters latest update date at that reporting period

ReportDateUpdateDateColumn AColumn BFlag
31st December 202020/12/2020 8:00:0010801
31st December 202015/12/2020 10:30:0088000
31st December 202001/12/2020 8:00:0044320
30th November 202029/11/2020 10:30:0090991
30th November 202026/11/2020 14:00:3344670
30th November 202015/11/2020 15:00:4450200

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can convert that expression to a measure and use it in a visual with the UpdateDate and ReportDate columns as follows

 

NewFlagColumn =
VAR vMaxThisPeriod =
    CALCULATE (
        MAX ( Report[UpdateDate] ),
        ALLEXCEPT (
            Report,
            Report[ReportDate]
        )
    )
RETURN
    IF (
        MIN(Report[UpdateDate]) = vMaxThisPeriod,
        1,
        0
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

You can convert that expression to a measure and use it in a visual with the UpdateDate and ReportDate columns as follows

 

NewFlagColumn =
VAR vMaxThisPeriod =
    CALCULATE (
        MAX ( Report[UpdateDate] ),
        ALLEXCEPT (
            Report,
            Report[ReportDate]
        )
    )
RETURN
    IF (
        MIN(Report[UpdateDate]) = vMaxThisPeriod,
        1,
        0
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Microsoft Employee
Microsoft Employee

Here is a column expression that should work.  Replace Report with your actual table name.  Note that I had to convert your first two columns to Date and Date/Time.

 

NewFlagColumn =
VAR vMaxThisPeriod =
    CALCULATE (
        MAX ( Report[UpdateDate] ),
        ALLEXCEPT (
            Report,
            Report[ReportDate]
        )
    )
RETURN
    IF (
        Report[UpdateDate] = vMaxThisPeriod,
        1,
        0
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


strangely, it gives me a red line under the Calculate function and the tool tip is "CALCULATE is not a function" 

BTW, the table is a result of DIRECT QUERY

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.