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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

I need help for DAX query Static to dynamic

Hello Team,

 

I Created below DAX function for Projects count purpose, its working fine only under but I need Dynamic view. present working in a static view.

 

In my present dashboard have a total of 9 filters, below DAX not reflecting those filters. 

 

Projects =
var a=MONTH( SELECTEDVALUE('Compliance Raw Data'[Month & Year]))-1
var c= FORMAT(max('Compliance Raw Data'[today]),"DD")
var d = FORMAT(max('Compliance Raw Data'[today]),"YYYY")
var e =CONVERT( CONCATENATE(c&"-",CONCATENATE(a&"-",d)),DATETIME)
return
CALCULATE(DISTINCTCOUNT('Compliance Raw Data'[Project ID]),ALL('Compliance Raw Data'),'Compliance Raw Data'[Project End Date]>=e,'Compliance Raw Data'[iManage Project Status]="A")
 
Sample raw dataSample raw datafilter.PNG
 
I need dynamic change for the above mentioned DAX function.
1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Modify your dax as follows:

 

Projects =
var a=MONTH( SELECTEDVALUE('Compliance Raw Data'[Month & Year]))-1
var c= FORMAT(max('Compliance Raw Data'[today]),"DD")
var d = FORMAT(max('Compliance Raw Data'[today]),"YYYY")
var e =CONVERT( CONCATENATE(c&"-",CONCATENATE(a&"-",d)),DATETIME)
return
CALCULATE(DISTINCTCOUNT('Compliance Raw Data'[Project ID]),ALLSELECTED('Compliance Raw Data'),'Compliance Raw Data'[Project End Date]>=e,'Compliance Raw Data'[iManage Project Status]="A")
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

4 REPLIES 4
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Modify your dax as follows:

 

Projects =
var a=MONTH( SELECTEDVALUE('Compliance Raw Data'[Month & Year]))-1
var c= FORMAT(max('Compliance Raw Data'[today]),"DD")
var d = FORMAT(max('Compliance Raw Data'[today]),"YYYY")
var e =CONVERT( CONCATENATE(c&"-",CONCATENATE(a&"-",d)),DATETIME)
return
CALCULATE(DISTINCTCOUNT('Compliance Raw Data'[Project ID]),ALLSELECTED('Compliance Raw Data'),'Compliance Raw Data'[Project End Date]>=e,'Compliance Raw Data'[iManage Project Status]="A")
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi Pragati,

 

Somewhat it is reflecting now, but when selected last historical month, not reflecting on last month 

 

Month "March" not reflectingMonth "March" not reflecting

 

Is there any best way to optimize the DAX function. Please help me 

Anonymous
Not applicable

Somewhat it is reflecting now, but when selected last historical month, not reflecting on last month "March" Datanot reflecting March month.PNG

Hi @Anonymous ,

 

What is the error on the card visual? Click on "See Details"

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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