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
ovonel
Post Prodigy
Post Prodigy

how to correctly order weeks within month?

I need to order the weeks correctly within a month, what's the optimal way to achieve it? ( I am consuming live from SSAS, so I will have to fix it in the cube if possible rather than in the pbix)

Instead of:

ovonel_0-1620649505098.png

 

 

 

I would like 52,53    53,1,2,3,4

4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @ovonel ,

 

Try create calculate column:

 

Index = WEEKNUM(data[Date],2)

 

 

image.pngimage.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ovonel
Post Prodigy
Post Prodigy

I get 

DAX Error A single value for column 'Year'... cannot be determined.
 
The date table has years 2000 to 2050. Shall I just pick max?

Hi, @ovonel 

Thank you for your feedback.

The below formula is for crating a new column.

Please share your sample pbix file, then I can try to look into it to come up with a more accurate formula for creating a new column.

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.


Go to My LinkedIn Page


Jihwan_Kim
Super User
Super User

Hi, @ovonel 

 

I think you need a new column (week end date column). Then you can sort it by this new column.

I assume you have a year column in the same table, and you can write something like the below formula to create a new column for the sorting purpose.

 

Weekending date CC =
VAR currentyear = 'Calendar'[Year]
VAR currentweeknumber = 'Calendar'[Week Number]
RETURN
CALCULATE (
MAX ( 'Calendar'[Date] ),
FILTER (
'Calendar',
'Calendar'[Year] = currentyear
&& 'Calendar'[Week Number] = currentweeknumber
)
)

 

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: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

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.


Go to My LinkedIn Page


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.