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
Jcho10
Frequent Visitor

Fiscal Year and Cumulative Sale

Hi everybody,

 

I would like to create this table in power bi but I have a few difficulties with “Fiscal Month” and “Cumulate Sales” :

 

Capture.GIF 

 

I’ve created differents measures and 1 dimension :

 

DIMENSION :

MonthName (Text Format) :

This dimension is created with a TableDate

 

MEASURES :

Sales by month Year N :

VAR

YearN = max('Parametres Year'[YearN])

RETURN

CALCULATE(

sum('SalesTable'[Sales]);

'SalesTable'[Year]=YearN;

)

 

Sales by month Year N-1 :

VAR

YearN-1 = max('Parametres Year'[YearN_1])

RETURN

CALCULATE(

sum('SalesTable'[Sales]);

'SalesTable'[Year]=YearN-1;

)

 

Cumulate Sale Year N :

CALCULATE(

[Sales by month Year N];

DATESYTD('TableDate'[Date];"31/05")

)

 

Cumulate Sale Year N-1 :

CALCULATE(

[Sales by month Year N_1];

DATESYTD('TableDate'[Date];"31/05")

)

 

 

And I get this table :

 Capture2.GIF

 

 

Could you please help me ?

                -How could I sort my dimension in Fiscal Month order ?

The Fiscal year start in 06/01 and finish in 05/31.

  

                -How could I calculate “Cumulate Sale Year N-1” with “MonthName” ?

 

Thank you for your help

 

Sincerely

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

Hi @Jcho10,

 

According to your description, you want to get the current sales, running current sales, previous sales, running previous sales, right?

 

If as I said, you can refer to below sample:

 

Table:

Capture.PNG

 

Measures:

Current Sales =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(all(SalesTable),MONTH(SalesTable[Date])=MONTH(currentDate)&& YEAR(SalesTable[Date])=YEAR(currentDate)),[SalesAmount])

 

Previous Sales =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(ALL(SalesTable),MONTH(SalesTable[Date])=MONTH(currentDate)&& YEAR(SalesTable[Date])=YEAR(currentDate)-1),[SalesAmount])

 

Running Current =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(ALL(SalesTable),MONTH(SalesTable[Date])<=MONTH(currentDate)&&YEAR(SalesTable[Date])=YEAR(currentDate)),[SalesAmount])

 

Running Previous =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(ALL(SalesTable),MONTH(SalesTable[Date])<=MONTH(currentDate)&&YEAR(SalesTable[Date])=YEAR(currentDate)-1),[SalesAmount])

 

Create the visuals.

 

Matrix:

Capture2.PNG

 

Slicer:

Capture3.PNG

 

Results:

Capture4.PNGCapture5.PNG

 

If above is not help, please share us some sample data.


Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Jcho10,

 

According to your description, you want to get the current sales, running current sales, previous sales, running previous sales, right?

 

If as I said, you can refer to below sample:

 

Table:

Capture.PNG

 

Measures:

Current Sales =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(all(SalesTable),MONTH(SalesTable[Date])=MONTH(currentDate)&& YEAR(SalesTable[Date])=YEAR(currentDate)),[SalesAmount])

 

Previous Sales =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(ALL(SalesTable),MONTH(SalesTable[Date])=MONTH(currentDate)&& YEAR(SalesTable[Date])=YEAR(currentDate)-1),[SalesAmount])

 

Running Current =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(ALL(SalesTable),MONTH(SalesTable[Date])<=MONTH(currentDate)&&YEAR(SalesTable[Date])=YEAR(currentDate)),[SalesAmount])

 

Running Previous =
var currentDate=MAX(SalesTable[Date])
return
SUMX(FILTER(ALL(SalesTable),MONTH(SalesTable[Date])<=MONTH(currentDate)&&YEAR(SalesTable[Date])=YEAR(currentDate)-1),[SalesAmount])

 

Create the visuals.

 

Matrix:

Capture2.PNG

 

Slicer:

Capture3.PNG

 

Results:

Capture4.PNGCapture5.PNG

 

If above is not help, please share us some sample data.


Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.