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

Display data only of current month in a visual

Hi,

I have a clustered column chart, where I want to display data of only the current month. My data source is a SharePoint list. The data format is dd-mm-yyyy. I have created a new column with the formula:

IsCurrentMonth =
IF (
YEAR ( TableName[Date] ) = YEAR ( TODAY () )
&& MONTH ( TableName[Date] ) = MONTH ( TODAY () ),
"Yes",
"No"
)
But it is taking the date format as mm-dd-yyyy.
chart.JPG
So instead of June (6) it is picking up the 6th day.
I have also tried:
IsCurrentMonth =
VAR a= FORMAT(YEAR (TableName[Date]),"dd-mm-yyyy")
VAR b= FORMAT(YEAR ( TODAY () ),"dd-mm-yyyy")
VAR c= FORMAT(MONTH (TableName[Date]),"dd-mm-yyyy")
VAR d= FORMAT(MONTH ( TODAY () ),"dd-mm-yyyy")
return
If (a=b && c=d, "Yes", "No")
 
Still getting the same issue. 
Please help. Thanks in advance.
3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

You can try this in a Calculated Column

 

CurrentMonth =
VAR a= YEAR (TableName[Date])
VAR b=YEAR ( TODAY () )
VAR c= MONTH (TableName[Date] )
VAR d=MONTH ( TODAY () )
return
If (a=b && c=d, "Yes", "No")

 

Regards,

Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Anonymous
Not applicable

@harshnathani Thanks for the reply, but still getting the same error. 😞

 

@Anonymous ,

 

Please share some sample data and the data type of the columns which are retrieved from Share Point.

 

Regards,

Harsh Nathani

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.

Top Solution Authors