Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

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 Selected

 

Average When not selected:

 

Average Unselected

 

 

 

 

 

1 Reply

  • Hi,

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