Forum Discussion

Vinod_G_245's avatar
Vinod_G_245
Helper I
3 years ago

Nested Aggregate function in Dax

Hi Team,

we have 3 categories ( Category, Subcategory, items) in table which we will recieve weekely, we will roll up to monthly, yearly.

we have two requirements in report( montly level slicer).

1. when category and any one of the below level(Subcategory,items) is selected then it is  average of sales( achieved).

2.When only category is selected(subcategory and items is not selected ) we want to take sum( montly average of column ). Im facing some challenges in this reqirement.

I used the below dax.

IF((AND(Sub-Category) = "",SELECTEDVALUE(Items) = "")),
SUM(Sales),AVERAGE(sales)  ---It is giving sum at week level but i want sum values at montly avergae value.
  expecting like this.
IF((AND(Sub-Category) = "",SELECTEDVALUE(Items) = "")),
SUM(average(Sales)),AVERAGE(sales) 
 
we tried  aggregate table but in modeling we are facing ambiguity, if this is sloved in Dax using variables it will be helpful for us.
 
Thanks in advance.

 

4 Replies