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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dax Formula with filter All Selected

Hi,

 

 I am struck with this Dax calculation I could use some help filtering out this cumulative sales calculation to get the monthly averages. I was thinking adding in an "Allselected" filter into this Dax formula, but I can't figure it out.

 

Here is the data when I make slicer selections, and the data seems to be working fine. But when I dont have any selections, The data comes in negative and is wrong.

 

I was able to get the Averages working on the Year page, but now I want the Current Month. Which I need help with this Dax -- I was thinking an "All Selected" Filter or something???

 

Thanks for any Help!

 

 

Sales $ CM =

VAR __PREV_MONTH =
CALCULATE(
        [Sales $ CY],
        DATEADD('Date'[Date],-1, MONTH)
    )
RETURN
    
    If(
If( [Sales $ CY] <> Blank () ,
([Sales $ CY] - __PREV_MONTH),
Blank()) = 0,
Blank(),
 
If( [Sales $ CY] <> Blank () ,
([Sales $ CY] - __PREV_MONTH),
Blank () )
)
 
 
Here is the Average When Selected:
Average When SelectedAverage When Selected

 

Average When not selected:

 

Average UnselectedAverage Unselected

 

 

 

 

 

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Clearly show the result that you are expecting.  Also, share the link from where i can download your PBI file.


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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.