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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
shanipowerbi
Helper III
Helper III

Need Month 1st date value in each row

Hi Expert

 

I need month 1st date value each day, for good understanding please see example below:

 

Date                Amount      1st Date Amount (required this)

01 Jan 2020    80,225           80,225

02 Jan 2020    80,400           80,225

03 Jan 2020    80,500           80,225

04 Jan 2020    80,800           80,225

04 Jan 2020    80,900           80,225

3 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi, @shanipowerbi 

 

Please try the below measure.

 

sales first day of month =
VAR currentyear =
YEAR ( MAX ( Sales[Date] ) )
VAR currentmonth =
MONTH ( MAX ( Sales[Date] ) )
VAR currentmonthfirstday =
DATE ( currentyear, currentmonth, 1 )
RETURN
CALCULATE ( Sales[sales], Sales[Date] = currentmonthfirstday )

 

Picture7.png

 

 

Hi, My name is Jihwan Kim.

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

Linkedin: https://www.linkedin.com/in/jihwankim1975/

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

Hi, @shanipowerbi 

I am not sure how you changed the context, but if it is OK with you, please share your sample pbix file's link, then I can try to look into it to come up with a more accurate measure.

 

Thank you.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

Hi,

please share your sample pbix file's link, then I can try to look into it.

 

Thank you.

 

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

7 REPLIES 7
Jihwan_Kim
Super User
Super User

Hi, @shanipowerbi 

 

Please try the below measure.

 

sales first day of month =
VAR currentyear =
YEAR ( MAX ( Sales[Date] ) )
VAR currentmonth =
MONTH ( MAX ( Sales[Date] ) )
VAR currentmonthfirstday =
DATE ( currentyear, currentmonth, 1 )
RETURN
CALCULATE ( Sales[sales], Sales[Date] = currentmonthfirstday )

 

Picture7.png

 

 

Hi, My name is Jihwan Kim.

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

Linkedin: https://www.linkedin.com/in/jihwankim1975/

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thanks, it worked, but it's not working when I turn the date in to Hierarchy 

 

 

 

Hi, 

I just posted a reply to your other post.

Please try the below.

 

sales first day of month =
VAR currentyear =
YEAR ( MAX ( Sales[Date] ) )
VAR currentmonth =
MONTH ( MAX ( Sales[Date] ) )
VAR currentmonthfirstday =
DATE ( currentyear, currentmonth, 1 )
RETURN
CALCULATE ( Sales[sales], filter (all (Sales), Sales[Date] = currentmonthfirstday ))

 

If you change the context from date to date-hierarchy, I think one more condition needs to be added to the measure.

 

Thanks.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi Kim

 

Thanks for the help, applied your suggested formula its working but not giving 1st day value 

 

I used this 

1st Day Billing = VAR currentyear =
YEAR ( MAX ( Billing[Date2] ) )
VAR currentmonth =
MONTH ( MAX ( Billing[Date2] ) )
VAR currentmonthfirstday =
DATE ( currentyear, currentmonth, 1 )
RETURN
CALCULATE ( Billing[Billing], filter (all (Billing), Billing[Date2] = currentmonthfirstday ))

Hi,

please share your sample pbix file's link, then I can try to look into it.

 

Thank you.

 

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi, @shanipowerbi 

I am not sure how you changed the context, but if it is OK with you, please share your sample pbix file's link, then I can try to look into it to come up with a more accurate measure.

 

Thank you.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

amitchandak
Super User
Super User

@shanipowerbi , with help from date table

 

calculate(sum(Table[Amount]), datesmtd(Date[Date]), filter(Date, Date[Date] = eomonth(Date[Date],0)+1))

 

or

 

calculate(sum(Table[Amount]), filter(allselected(Table), Table[Date] = eomonth(Table[Date],0)+1))

 

 

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.