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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors