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
hari_bi
Helper I
Helper I

Decreasing order of cummulative totals in DAX depending on months?

Hello All,

 

Please find the above table:

YTG2.PNG

 

Query : Base 1 is null/blank  in any month then i need to sum the Base 2 values from that null month to till last month of month of that year and need to display the value in new column called Achievement.

 

Example  1 :-  Jan-18 base 1 is null, so i need to add Base 2 values from Jan-18 to Jun-18 ( 100 +200+200+100+150+200= 950)

 

next Feb-18 base 1 value is null again i need to add Base 2 values from Feb-18 to Jun-18 ( 200+200+100+150+200= 850)

 

Next time i need to add Base 2 values from Mar-18 to Jun-18 ( 200+100+150+200= 650) on so on ..... till the last month.

 

Need help to create Dax for the above requirement.

 

 

Thanks,

Hari.

 

 

1 ACCEPTED SOLUTION

Hi,

 

Here is the measure i used

 

Achievement = if(ISBLANK([Base1]),CALCULATE([Base2],DATESBETWEEN('Date'[Date],MIN('Date'[Date]),CALCULATE(MAX('Date'[Date]),ALL('Date'[Year Month])))),BLANK())

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
hari_bi
Helper I
Helper I

Hello,

 

Please Find the below PBI File link for the same.

 

https://www.dropbox.com/s/dfxma4lcd76ucvs/PBI.pbix?dl=0

 

 

Thanks,

Hari.

Hi,

 

Here is the measure i used

 

Achievement = if(ISBLANK([Base1]),CALCULATE([Base2],DATESBETWEEN('Date'[Date],MIN('Date'[Date]),CALCULATE(MAX('Date'[Date]),ALL('Date'[Year Month])))),BLANK())

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish Mathur,

 

Much appreciated .

Thanks for the query.

 

Regards,

Hari.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.