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
maneschr2022
Helper II
Helper II

How to count values per week

Hi, I would like to create a measure that allows me to count a total value per week from a column called ID . I created a column that`s called Week of the month, and shows the week number on each month.  the week numbers are 1 to 4 or 5 on each Month as I consider it more readable.

 

Thanks a lot for the help!

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @maneschr2022 ,

 

Not sure what your data table looks like, but if you want to create count a total value per week on your description, you could try creating a measure like this.

Total = CALCULATE(SUM('Table'[ID]))

Then drag it into the visual along with the calculated columns in the date table.

Week of the month = 
VAR _monthnum = MONTH('Date'[Date])
VAR _month = 
SWITCH(TRUE(),
_monthnum=1,"Jan",
_monthnum=2,"Feb",
_monthnum=3,"Mar",
_monthnum=4,"Apr",
_monthnum=5,"May",
_monthnum=6,"Jun",
_monthnum=7,"Jul",
_monthnum=8,"Aug",
_monthnum=9,"Sept",
_monthnum=10,"Oct",
_monthnum=11,"Nov",
_monthnum=12,"Dec"
)
VAR _weeknum =INT(DAY('Date'[Date])/7+1)
RETURN
"Week "&_weeknum&" of the "&_month

vcgaomsft_0-1648186704351.png

If this doesn't work for you or I misunderstand your needs, please consider sharing more details about it. And it would be great if there was a sample file without any sensitive information here.

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @maneschr2022 ,

 

Not sure what your data table looks like, but if you want to create count a total value per week on your description, you could try creating a measure like this.

Total = CALCULATE(SUM('Table'[ID]))

Then drag it into the visual along with the calculated columns in the date table.

Week of the month = 
VAR _monthnum = MONTH('Date'[Date])
VAR _month = 
SWITCH(TRUE(),
_monthnum=1,"Jan",
_monthnum=2,"Feb",
_monthnum=3,"Mar",
_monthnum=4,"Apr",
_monthnum=5,"May",
_monthnum=6,"Jun",
_monthnum=7,"Jul",
_monthnum=8,"Aug",
_monthnum=9,"Sept",
_monthnum=10,"Oct",
_monthnum=11,"Nov",
_monthnum=12,"Dec"
)
VAR _weeknum =INT(DAY('Date'[Date])/7+1)
RETURN
"Week "&_weeknum&" of the "&_month

vcgaomsft_0-1648186704351.png

If this doesn't work for you or I misunderstand your needs, please consider sharing more details about it. And it would be great if there was a sample file without any sensitive information here.

 

Best Regards,
Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Ashish_Mathur
Super User
Super User

Hi,

Create a relationship from the week column in your base data table to the week column of the Calendar table.  To your visual, drag the week column from the Calendar Table.  Write this measure

Total = sum(Data[Amount])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.