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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
donodackal
Helper I
Helper I

Categorise data by expiry date

Hello

 

I have got a table that contains contract expiry dates. Would like to create a new column that identifies contracts as

  • Expired
  • Expiring in 90 Days
  • Expiring in 180 Days
  • Expiring 180 Days + 

My final output is creating a matrix table that counts the number of contracts falling in the four categories above. 

Can anyone help with the steps to get this output?

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Picture1.png

 

Contracts count: =
CALCULATE (
COUNTROWS ( VALUES ( Data[Contract] ) ),
FILTER (
Data,
CALCULATE (
COUNTROWS ( Category ),
FILTER (
Category,
Data[Expiry date] - TODAY () >= Category[Min period]
&& Data[Expiry date] - TODAY () <= Category[Max period]
)
) > 0
)
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


ryan_mayu
Super User
Super User

@donodackal 

pls  try this

category = 
VAR gap='Table'[expiry date]-TODAY()
return SWITCH(TRUE(),gap<0,"expired",gap<=90,"Expiring in 90 Days",gap<=180,"Expiring in 180 Days","Expiring 180 days +")

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan, 

 

Tried the formula but it throws up errors, am I entering it correctly?

donodackal_0-1645049739211.png

 

@donodackal 

try to use DAX to create a column, not in the PQ editor.

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.