cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leazimmer
Frequent Visitor

Problem with calculation of actual calenderweek

Hi together,

i need for my report a calculation to the actual year, month, quartal and week

year, month and quartal with the function TOTALQTD.

For the actual week i have use the code:

lfd. KW = CALCULATE([Anzahl Kunden],FILTER(ALL('Datumstabelle'),'Datumstabelle'[KalenderWoche]=SELECTEDVALUE('Datumstabelle'[KalenderWoche])))
I hope somebody can help me
Best wish and thank you
Lea
1 ACCEPTED SOLUTION
amitchandak
Super User IV
Super User IV

4 REPLIES 4
HarishKM
Responsive Resident
Responsive Resident

@leazimmer  Hey ,

first create a date hirerachy then drag that to a slicer  from there you will get Year ->Month -> Week->Date

 

from slicer itself you can slice and dice different level of data .

then 

sales = calculate(sum(tablename[sales])
drag that in to the matrix 
you can slice month  you will monthly data 

 

HarishKM_0-1618553714734.png

for Time intelligence related dax a

you can use Dateadd and sameperiodlastyear (Year on year comparision) dax function

YTD = calculate(sum(tablename[sales]),dateytd(date[date])
last 4 week = calculate(sum(table[sales]),dateadd(date[date],-28,day)

QTD = CALCULATE(SUM(Sheet1[Sales]),DATESQTD(Sheet1[Date])

use above dax function to get desired output.
 
Kudos will be appriciated 

 

v-yuaj-msft
Community Support
Community Support

Hi @leazimmer ,

 

Sorry for that maybe I'm not getting what actually you are trying to do. I'm confused about the expression given without any data information. 

Could you please share some sample data and the expected result to have a clear understanding of your question? I can do some tests for you.

You can save your files in some cloud sharing platforms and share the link here.

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

Do you want to distinctcount the number of calendar weeks in each category? I did a test. Is the following result what you want?

Weeknumber = WEEKNUM('Sheet1'[Date],2)
Measure = 
CALCULATE(
    DISTINCTCOUNT('Sheet1'[Weeknumber]),
      ALLEXCEPT(Sheet1,Sheet1[Category])
          )

Result:

v-yuaj-msft_0-1618551493768.png

 

Best Regards,

Yuna

leazimmer
Frequent Visitor

Thank you very much for your fast answer, but my result is a blank field

That is the customized code

Aktuelle Woche = CALCULATE(COUNT(konzeptum[Kundennummer]), FILTER(ALL('Datumstabelle'),'Datumstabelle'[Wochen Rank]=max('Datumstabelle'[Wochen Rank])))
Best wish and thank you
Lea
amitchandak
Super User IV
Super User IV

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors