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
Pezir
Frequent Visitor

Create column, Display Data from another column if current month, otherwise blank

Hi!

 

I try to explain this. Man Very Happy

I would like to create a new column which shows data from another column (sales) IF that sale has happened in current month OTHERWISE blank cell.

I have created the calendar which has a data "IsCurrentMonth" = 1, if helps.

 

Goes too complicated for my brains, would appreciate your help. Thanks!

6 REPLIES 6
venug20
Resolver I
Resolver I

@Pezir

 

Can you provide sample data for your quiery.... 

Pezir
Frequent Visitor

@venug20
Maybe this picture will help. Lets imagine that CurrentMonth is 9th. I would like to create New Column which shows only data from CurrentMonth.

 

data.JPG

I have also created a IsCurrentMonth column in calendar if we can use that. 

 

currentmonth.JPG

Thank you!

@Pezir

 

Please look into this formula, it may helps you...

 

Datef = IF(CurrentMonth[Date] < [SM] , BLANK(), CALCULATE(SUM(CurrentMonth[Sales]),  DATESBETWEEN(CurrentMonth[Date], [SM], MAX(CurrentMonth[Date]))))

 

Current-Month-Sales.jpg

 

When i try to your reuqirement, as you mention above like "Blank".... 

it throughs error, why because not retrun text and calculation as well as.

 

see error below...

 

 

MTD-Blank-Error.jpg

 

It it is solution to your query. Please accept as a solution, it is helpful to others.....

 

@Pezir

 

i forgot to provide SM Formula...

 

SM = DATE(YEAR(TODAY()), MONTH(TODAY()), 1)

Pezir
Frequent Visitor

Thank you @venug20 I will try this later. 

@Pezir,

 

You may just add measure below.

Measure =
CALCULATE ( SUM ( Table1[Sales] ), 'Calendar'[IsCurrentMonth] = 1 )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.