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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Need helip on below logic

Hi All,

         I have a table like below. If select date range in a slicer between Start Date=01/04/2021 to End date =30/06/2021 it should get all the 'Active' Pol numbers before the start date. Then it need to check whether that Active pol number is 'calcelled' between the start date and end date. If it is cancelled then i need to get the Original Comm like 500-300=200 as the pol is cancelled.

        If i select date range between Start Date = 01/07/2021 and End Date = 30/09/2021 it need to check all the pol num which were Active and Cancelled before the start date. Then it need to check if the Active and Cancelled pol nums are Reintiated between the start date and end date. If it is reintiated i need to get the Cancellation comm like -300+200=-50

 

Thanks in advance.

 

Table:

1.PNG

 

Expected O/P

2.PNG

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , based on what I got. Assume date is selected using independent date table

 


Measure =
VAR _max = MAXX(allselected('Date1'),'Date1' [date])
var _min = MinX(allselected('Date1'),'Date1' [date])
var _Active = calculate(sum(Table[Comm]), filter( Table, Table[End date]<= _max and Table[End date]>=_min && Table[Tran Type] ="Active"))
var _can = calculate(sum(Table[Comm]), filter( Table, Table[End date]<= _max and Table[End date]>=_min && Table[Tran Type] ="Cancelled"))
var _re= calculate(sum(Table[Comm]), filter( Table, Table[End date]<= _max and Table[End date]>=_min && Table[Tran Type] ="Reintiated"))
return
if(isblank(_re), _Active + _can , _re+_can)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak this does nto work for me. There is no logic in your query you have directly taken the values and filtered them any way thanks.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors