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
So my Data is in the following format.
| ReportDate | UpdateDate | Column A | Column B |
| 31st December 2020 | 20/12/2020 8:00:00 | 10 | 80 |
| 31st December 2020 | 15/12/2020 10:30:00 | 88 | 00 |
| 31st December 2020 | 01/12/2020 8:00:00 | 44 | 32 |
| 30th November 2020 | 29/11/2020 10:30:00 | 90 | 99 |
| 30th November 2020 | 26/11/2020 14:00:33 | 44 | 67 |
| 30th November 2020 | 15/11/2020 15:00:44 | 50 | 20 |
I need to add one CALCULATED COLUMN, say FLAG, which becomes 1 when it encounters latest update date at that reporting period
| ReportDate | UpdateDate | Column A | Column B | Flag |
| 31st December 2020 | 20/12/2020 8:00:00 | 10 | 80 | 1 |
| 31st December 2020 | 15/12/2020 10:30:00 | 88 | 00 | 0 |
| 31st December 2020 | 01/12/2020 8:00:00 | 44 | 32 | 0 |
| 30th November 2020 | 29/11/2020 10:30:00 | 90 | 99 | 1 |
| 30th November 2020 | 26/11/2020 14:00:33 | 44 | 67 | 0 |
| 30th November 2020 | 15/11/2020 15:00:44 | 50 | 20 | 0 |
Solved! Go to Solution.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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
To learn more about Power BI, follow me on Twitter or subscribe 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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 54 | |
| 37 | |
| 32 | |
| 17 | |
| 15 |
| User | Count |
|---|---|
| 64 | |
| 63 | |
| 37 | |
| 34 | |
| 22 |