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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
sagadgreat
Helper I
Helper I

Count number of weeks in a year

I have a problem that I beleive can only be solved by creating a table that counts the number of ISO weeks in a year.  I created a table (Year) that pulls in distinct year values for the past 3 years based on a separate (Dates) table.  I attempted to do a count of distinct weeks (Dates[ISOWeekNum]), but this was the result as there are truly a total of 53 weeks on the table.  I've tried several options to try to get it to be based on the Year column, but none are working.  Thoughts?:  

sagadgreat_0-1612971649245.png

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Try wrapping your DISTINCTCOUNT with CALCULATE( ), assuming you have a relationship between this table and your Dates table on the Year columns.  If not, you need to use TREATAS to pass the Year filter to the dates table.

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Employee
Employee

Try wrapping your DISTINCTCOUNT with CALCULATE( ), assuming you have a relationship between this table and your Dates table on the Year columns.  If not, you need to use TREATAS to pass the Year filter to the dates table.

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Haha, I never thought of connecting the years back to the original table.  Going to give it a shot.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.