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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Atif
Resolver I
Resolver I

YTD Revenue Calculation

I have tried the follwoing formula for my YTD Revenue calculation (Fiscal Year based), but I am not getting the running total.

 

YTD Revenue = TOTALYTD(SUM(Sheet1[Revenue]), 'Sheet1'[Date])

 

I have also applied the same formula with "date" column present in a separate file. Still the same result.

 

The function datesytd with last date being mentioned within quotes <"6/30"> is also not working.

24 REPLIES 24
RolandsP
Resolver IV
Resolver IV

Have you created Date table and established correct relationship with the Fact table

Yes, I have also tried it, but to no avail.

Hi @Atif,

 

Could you please share dummy data or show how your data model.

It is not the 'Sheet1'[Date]) but rather the calendar[Date] in the formulae:

You can also try this following one:

YTD Revenue = calculate(SUM(Sheet1[Revenue]), dateytd('calendar'[Date],"6/30"))

Ninter

hi there Ninter @Interkoubess

 

The data is something like this in table 1

 

StationBilling UnitRevenueDatePublicationPrimary
KarachiDJK13,500,0007/1/17Jang72017
KarachiDJK13,500,0008/1/17Jang82017
KarachiDJK13,500,0009/1/17Jang92017
KarachiDJK13,500,00010/1/17Jang102017
KarachiDJK13,500,00011/1/17Jang112017
KarachiDJK13,500,00012/1/17Jang122017
KarachiDJK01/1/18Jang12018
KarachiDJK02/1/18Jang22018
KarachiDJK03/1/18Jang32018
KarachiDJK04/1/18Jang42018
KarachiDJK05/1/18Jang52018
KarachiDJK06/1/18Jang62018
KarachiTNK9,000,0007/1/17News72017
KarachiTNK9,000,0008/1/17News82017
KarachiTNK9,000,0009/1/17News92017
KarachiTNK9,000,00010/1/17News102017
KarachiTNK9,000,00011/1/17News112017
KarachiTNK9,000,00012/1/17News122017
KarachiTNK01/1/18News12018
KarachiTNK02/1/18News22018
KarachiTNK03/1/18News32018
KarachiTNK04/1/18News42018
KarachiTNK05/1/18News52018
KarachiTNK06/1/18News62018

 

Table 2

PrimaryDate
720117/1/11
820118/1/11
920119/1/11
10201110/1/11
11201111/1/11
12201112/1/11
120121/1/12
220122/1/12
320123/1/12
420124/1/12
520125/1/12
620126/1/12
720127/1/12
820128/1/12
920129/1/12
10201210/1/12
11201211/1/12
12201212/1/12
120131/1/13
220132/1/13
320133/1/13
420134/1/13
520135/1/13
620136/1/13

 

This does not seem to be correct Date table. Date table should be incremental and include all dates from minimum date up to maximum date in your fact table 

@RolandsP 

The "date" table have all the dates (uniques).

Hi @Atif,

 

Did you try the formulae I gave?

 

Ninter

@InterkoubessYes, I have tried, but didn't work - Am I doing right by trying to create a relationship between the two tables using "Primary" column?

Hi @Atif,

 

Nope. Please link the date from calendar with the date of your fact table.

 

Ninter

@InterkoubessWhile trying to connect the two tables using "date" column" it gives a message "You can't create a relationship between these two columns because one of the columns must have unique values."

 

Please note that "table 2" only contains unique values i.e., not being duplicated.

Hi @Atif,

 

How did you create your calendar tabe?

 

Ninter

@Interkoubess

Yes, table 2

Hi @Atif,

 

It seems not (to have unique values) otherwise the system won't show this message.

 

I tried a calendar with your dummy data and it worked on my side...

 

Please review yur calendar formula or table...

 

Ninter

@Interkoubess @RolandsP

 

I have used the option of "New Table" under "Modeling" tab.

 

The formula I used is "Calendar = CALENDAR(MIN(Sheet1[Date]),MAX(Sheet1[Date]))".

 

@Interkoubess @RolandsP

 

The "date" column" is used to relate the two tables with "cardinality" being "many to one" and "cross filter direction" as "single".

 

When I use "YTD Revenue = CALCULATE(SUM(Sheet1[Revenue]), 'Calendar'[Date])" it displays "0" in the first column and the rest of the years have values of each mont rather than having a running total.

 

When I use "YTD Revenue = TOTALYTD(SUM(Sheet1[Revenue]), 'Calendar'[Date])" it only displays "0".

Hi @Atif,

 

With your formula with calculate your missed DATEYTD

Please add it like this:

 

YTD Revenue = CALCULATE(SUM(Sheet1[Revenue]),DATEYTD( 'Calendar'[Date],"6-30"))

OR ( date format with /)

 

YTD Revenue = CALCULATE(SUM(Sheet1[Revenue]),DATEYTD( 'Calendar'[Date],"6/30"))

 

Ninter

@Interkoubess

 

The formula "YTD Revenue = CALCULATE(SUM(Sheet1[Revenue]), DATESYTD('Calendar'[Date], "6/30"))" is displaying "0" in "column 1" and respective values of "FY18" in "column 2".

 

The figures for previous years are now missing.

 

The running total is also not being calculated.

Hi @Atif,

 

Why are you talking about column1.

It is a measure not a calculated column....

It worked on my side so you are doing something wrong...

 

Ninter

@Interkoubess

 

Do you think I have correctly created "calendar" table by using "Calendar = CALENDAR(MIN(Sheet1[Date]),MAX(Sheet1[Date]))"?

 

I have checked the said table in "data mode" and no date is missing.

 

Do you think I have correctly linked the two tables by using column "date"?

 

If above two steps are accurate, then kindly share the formula for "YTD Revenue".

@Interkoubess @RolandsP

 

The formula "YTD Revenue = TOTALYTD(SUM(Sheet1[Revenue]), 'Calendar'[Date])" returns a table with column headings "Month Name" and "Total" and row heading "Total".

 

The formula "YTD Revenue = CALCULATE(SUM(Sheet1[Revenue]), 'Calendar'[Date])" returns all values, but not the running total. For e.g. 100 for July and 100 for August. I need 100 for July and the value to be added subsequently in following months.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.