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
PijushRoy
Super User
Super User

DAX for Cumulated total required Product and Month wise

Hi Team,

I have DataTable and Calendar table. In DataTable, I don't have a date column.
I need to show Months wise and Product wise Cumulative sales total per year.

My fiscal year from JULY to JUNE

I have created another Calendar Table for Cumulative total and relationship.

 

In the below screenshot, you can find wrong data is coming

01.JPG

 

The calculation I am using for Specific year wise

FY21_Cumm_Sales = 
VAR _Sales = CALCULATE(SUM('DataTable'[SalesFY21]),
            FILTER(ALLEXCEPT('DataTable','DataTable'[Product]),
            'DataTable'[Fiscal_MonthNo] <= MAX('DataTable'[Fiscal_MonthNo])))
VAR _SelectedMonth = SELECTEDVALUE(Calnedar[Calendar_MonthNo])
RETURN
CALCULATE(_Sales, CROSSFILTER(Calnedar[Fiscal_MonthNo],'DataTable'[Fiscal_MonthNo],None),
FILTER('Calender for Commulative','Calender for Commulative'[Fiscal_MonthNo] >= _SelectedMonth))

 

Please find the PBIX file. and Expected Result file in Excel

 

YOUR HELP IS HIGHLY APPRECIATED, THANKS

2 ACCEPTED SOLUTIONS
negi007
Community Champion
Community Champion

@PijushRoy I have created a date field in your both date and data table to link the table

negi007_0-1672065779234.png

and then below measure can help to calc ytd value

 

TotalYTD_Vol = TOTALYTD(SUM('DataTable'[Amount]),Calnedar[Date],ALL(Calnedar[Date]),"Jun 1")



Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

HI @PijushRoy and @negi007 
There are two solutions in the attached file, mine and @negi007 , take a look and decide which one suits you better. 
You can accept both my decision and @negi007 
Screenshot_24.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

6 REPLIES 6
PijushRoy
Super User
Super User

Thanks @DimaMD @negi007 
Both solutions are working

negi007
Community Champion
Community Champion

@PijushRoy I have created a date field in your both date and data table to link the table

negi007_0-1672065779234.png

and then below measure can help to calc ytd value

 

TotalYTD_Vol = TOTALYTD(SUM('DataTable'[Amount]),Calnedar[Date],ALL(Calnedar[Date]),"Jun 1")



Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

DimaMD
Solution Sage
Solution Sage

Hi @PijushRoy  see the attached file, I have made changes to your measure

FY23_Cumm_Sales = 
VAR _Sales = CALCULATE(SUM('DataTable'[SalesFY23]),
            FILTER(ALLEXCEPT('DataTable','DataTable'[Product]),
            'DataTable'[Fiscal_MonthNo] <= MAX('DataTable'[Fiscal_MonthNo])))
VAR _SelectedMonth = MIN('DataTable'[Fiscal_MonthNo])
RETURN
CALCULATE(_Sales, 
FILTER('DataTable','DataTable'[Fiscal_MonthNo] <= _SelectedMonth))


Screenshot_23.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Hi @DimaMD 

 

Yes, it is working when taking slicer value from DataTable.
But I can't take slicer form DataTable because I have other visual in same page and common slicer from Calender table.

I am facing same issue, any way to solve this?

 

Thanks for your reply

HI @PijushRoy and @negi007 
There are two solutions in the attached file, mine and @negi007 , take a look and decide which one suits you better. 
You can accept both my decision and @negi007 
Screenshot_24.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

@PijushRoy did you try the solution suggested by me.




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

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.