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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Calculate Between 320 and 365

Hi,

 

I m using below measures to calculate Total count between 320 and 365 days.Its showing blank value..Is this measure is correct ?

 

Date'[Date] is calendar table join with Table [CREATED_ON]) .

 

Age= CALCULATE(COUNT(Table [CREATED_ON]),DATESBETWEEN(Table[CREATED_ON],LASTDATE(DATEADD('Date'[Date],-320,DAY)),LASTDATE(DATEADD('Date'[Date],-365,DAY)) ) )

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Its working . For older than 1 year .

it should  be  below measure right?

Age=
var _dt =minx('Date','Date'[Date])
var _min =_dt+365
return
CALCULATE(COUNT(Table [CREATED_ON]),Table [CREATED_ON]>=_min)

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , try like

Age=
var _dt =minx('Date','Date'[Date])
var _min =_dt-365
var _max = _dt -320
return
CALCULATE(COUNT(Table [CREATED_ON]),Table [CREATED_ON]>=_min,Table [CREATED_ON]<=_max)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Its working . For older than 1 year .

it should  be  below measure right?

Age=
var _dt =minx('Date','Date'[Date])
var _min =_dt+365
return
CALCULATE(COUNT(Table [CREATED_ON]),Table [CREATED_ON]>=_min)

Hi @Anonymous ,

It's the same principle if the previous measure worked.

Glad to hear the issue is solved. You can accept your reply as solution, that way, other community members could easily find the answer when they get same issues.


Best Regards,
Yingjie Li

az38
Community Champion
Community Champion

@Anonymous 

try

Age= CALCULATE(
COUNT(Table[CREATED_ON]),
DATESBETWEEN(Table[CREATED_ON],DATEADD(LASTDATE('Date'[Date]),-320,DAY),DATEADD(LASTDATE('Date'[Date]),-365,DAY) ) )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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