The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello, I am trying to create a calculated column to track day-to-day changes to claims. The highlighted Change column is the objective. I want to compare the Claim # to only the prior working day report to track the changes. I provided a simplified version of the data below. The Change column for 4/22/20 can be blank because it is the starting point thus no prior report to compare.
Solved! Go to Solution.
hi @Anonymous
You could use this logic to get it:
Change =
var _firstdate=CALCULATE(MIN('Table'[Report Date]),ALL('Table'))
var _perdate=CALCULATE(MAX('Table'[Report Date]),FILTER('Table','Table'[Report Date]<EARLIER('Table'[Report Date])))
var _perclaimstatus=CALCULATE(MAX('Table'[Status]),FILTER('Table','Table'[Report Date]=_perdate&&'Table'[Claim #]=EARLIER('Table'[Claim #])))
return
IF (
_firstdate = 'Table'[Report Date],
BLANK (),
IF (
CALCULATE (
MAX ( 'Table'[Claim #] ),
FILTER (
'Table',
'Table'[Report Date] = _perdate
&& 'Table'[Claim #] = EARLIER ( 'Table'[Claim #] )
)
)
= BLANK (),
"New",
IF (
'Table'[Last Saved Date] = BLANK ()
&& _perclaimstatus <> 'Table'[Status],
'Table'[Status],
IF (
_perclaimstatus = 'Table'[Status]
&& 'Table'[Last Saved Date] < _perdate,
"No Change",
IF (
_perclaimstatus = 'Table'[Status]
&& 'Table'[Last Saved Date] >= _perdate,
"Updated"
)
)
)
)
)
Result:
and here is sample pbix file, please try it.
Regards,
Lin
hi @Anonymous
You could use this logic to get it:
Change =
var _firstdate=CALCULATE(MIN('Table'[Report Date]),ALL('Table'))
var _perdate=CALCULATE(MAX('Table'[Report Date]),FILTER('Table','Table'[Report Date]<EARLIER('Table'[Report Date])))
var _perclaimstatus=CALCULATE(MAX('Table'[Status]),FILTER('Table','Table'[Report Date]=_perdate&&'Table'[Claim #]=EARLIER('Table'[Claim #])))
return
IF (
_firstdate = 'Table'[Report Date],
BLANK (),
IF (
CALCULATE (
MAX ( 'Table'[Claim #] ),
FILTER (
'Table',
'Table'[Report Date] = _perdate
&& 'Table'[Claim #] = EARLIER ( 'Table'[Claim #] )
)
)
= BLANK (),
"New",
IF (
'Table'[Last Saved Date] = BLANK ()
&& _perclaimstatus <> 'Table'[Status],
'Table'[Status],
IF (
_perclaimstatus = 'Table'[Status]
&& 'Table'[Last Saved Date] < _perdate,
"No Change",
IF (
_perclaimstatus = 'Table'[Status]
&& 'Table'[Last Saved Date] >= _perdate,
"Updated"
)
)
)
)
)
Result:
and here is sample pbix file, please try it.
Regards,
Lin
Thank you! I made some minor edits and it works as I intended.
See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
111 | |
80 | |
78 | |
43 | |
37 |
User | Count |
---|---|
158 | |
111 | |
64 | |
59 | |
54 |