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
Jack_Reacher
Helper II
Helper II

Need Help with Line Chart Aggregation Issue: Two DAX Measures Result in Enormous Values

Hello all,

I have the table displayed below which represents the data I want to show on a line graph, the desired outcome is to have two lines, one for the current rolling 12 months, and another for the prior rolling 12 months. I have created the following DAX measures to display the line charts displayed below. The problem I have here is that the values aggregate in an enormous manner over the graph periods, and I can't figure out why this is happening. 

AAAM_Current_R12M = CALCULATE(SUM(AMD[DDep]), DATESINPERIOD('Calendrier'[Date], ENDOFMONTH('Calendrier'[Date]), -12, MONTH))
 
AAAM_Prior_R12M = CALCULATE(SUM(AMD[DDep]), DATESINPERIOD('Calendrier'[Date],ENDOFMONTH(dateadd('Appointments Manager'[Period date],-12,month)),-12,MONTH))
 
PeriodCal = FORMAT(Calendrier[Date], "mmm"&" "&"yyyy")
 

For info, I have a date table named "Calendrier" which is set as the default date table, and the PeriodDate starts from Jan 2021.

 

Jack_Reacher_0-1683069954176.png

Jack_Reacher_2-1683070602890.png

 

Jack_Reacher_1-1683070400255.png

 

I really appreciate your assistance

 

Thank you

 

 

5 REPLIES 5
v-tangjie-msft
Community Support
Community Support

Hi @Jack_Reacher ,

 

According to your description, here are my steps you can follow as a solution.

(1)My test data is the same as yours.

vtangjiemsft_0-1683181851428.png

(2) We can create two measures.

Rolling ddep  current 12 month =
CALCULATE (
    SUM ( AMD[Ddep] ),
    DATESBETWEEN (
        'Calendrier'[Date],
        EDATE ( MIN ( 'Calendrier'[Date] ), -11 ),
        MAX ( 'Calendrier'[Date] )
    )
)
Rolling ddep for previous 12 months =
CALCULATE (
    SUM ( 'AMD'[Ddep] ),
    DATESBETWEEN (
        'Calendrier'[Date],
        EDATE ( MIN ( 'Calendrier'[Date] ), -23 ),
        EDATE ( MAX ( 'Calendrier'[Date] ), -12 )
    )
)

(3) Then the result is as follows.

vtangjiemsft_1-1683181959545.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hello @v-tangjie-msft , sorry the late response, I tested many times but still getting the undersider result please find below the link for the Power BI file related to this issue: https://drive.google.com/file/d/1-u6GF_cygXVfBhzMIRmdOVlZWlfk-_Xt/view?usp=share_link



This is an example of the desired outcome: 

 

Jack_Reacher_0-1683282910228.png

 

Hi @Jack_Reacher ,

 

Please try:

vtangjiemsft_1-1683538718887.png

 

AAAM_Current_R12M = 

CALCULATE(SUM('Sales deployed per full month'[Sales Deployed]),FILTER(ALL(DateTable),[Date]>=EOMONTH(MAX('DateTable'[Date]),-11)&&[Date]<=EOMONTH(MAX('DateTable'[Date]),0)))
AAAM_Prior_R12M = 


CALCULATE(SUM('Sales deployed per full month'[Sales Deployed]),FILTER(ALL(DateTable),[Date]>=EOMONTH(MAX('DateTable'[Date]),-23)&&[Date]<=EOMONTH(MAX('DateTable'[Date]),-11)))

vtangjiemsft_0-1683538700841.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

hello @v-tangjie-msft , unfortunately that is not the correct output graph I want. this is what the end results should look like, which I solved recently: 

Now I just need to be able to sort by Month and Year in this format April 2022, etc. which I can't figure out yet. Any help is much appreciated. this is the file Google Drive, Power BI file used 

Jack_Reacher_0-1683550295395.png

 

Thank you for your reply @v-tangjie-msft , I will test and revert back to you. It seems like your results still shows big numbers, and I simply wanna show DDep values. I will share with you a simplied BI file too. 

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.