Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hello All,
I have a data set in table as shown below:
What I need to do is that loop through the records by date, if Cust ID has 2 or more records on the same day or diffrent dates, with the TYPE value = A or D, then give me those records and subtract High value from the Low value.
Desired Result
Thanks
Solved! Go to Solution.
Hey @sabeensp
It works just fine for me, with the sample you have provided.
You can share your current data, then we can further assist you.
Cheers!
A
Hey @sabeensp
Try the following:
DIFF =
VAR NUM_OF_SHOWS =
CALCULATE (
COUNTROWS ( T11 ),
FILTER (
T11,
T11[CUST_ID]
= EARLIER ( T11[CUST_ID] )
),
FILTER (
T11,
T11[TYPE] = "A"
|| T11[TYPE] = "D"
)
)
RETURN
IF (
NUM_OF_SHOWS > 0,
ABS ( T11[HIGH] - T11[LOW] ),
-1
)Then filter the visual where DIFF is not blank and above 0.
Good Luck!
A
@Anonymous I get an error Earler/Earliset refers to an earler row context, which does not exsist.
Hey @sabeensp
It works just fine for me, with the sample you have provided.
You can share your current data, then we can further assist you.
Cheers!
A
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!