Forum Discussion

niyaz006's avatar
niyaz006
Frequent Visitor
3 years ago

DAX to show same value for missing months

My data

CategorySub categoryDateValue
Cat1Subcat11-Jan1
Cat1Subcat21-Jan1
Cat2Subcat31-Jan1
Cat2Subcat41-Jan1
Cat1Subcat11-Feb2
Cat1Subcat21-Mar2
Cat2Subcat41-Mar3

 

The value ranges from 1 to 5. I am looking to create a table like below

 

Month#Value 1s#Value 2s#Value 3s# Value 4s# Value 5s
1-Jan40000
1-Feb31000
1-Mar12 (1+1)

1

00

 

In Feb, 1 entry's has value changed to 2. Hence, that row from the previous month is ignored, but every other record (3 x 1s) is counted

I tried something like the below:

 

Cumulative Value Count = 
CALCULATE(
    COUNTROWS(SUMMARIZE(Table, [Cat], [Subcat])),
    FILTER(ALL(Table[date]), 
        Table[startdate] <= MAX(Table[date])
        )
    )

 

 But my output was (it is not reducing the value 1s when they have moved to 2s and 3s, ....

Month#Value 1s#Value 2s#Value 3s# Value 4s# Value 5s
1-Jan40000
1-Feb41000
1-Mar42 100

 

Any help/guidance?

2 Replies

    • niyaz006's avatar
      niyaz006
      Frequent Visitor

      The value column can have values from the range (1 to 5). These are like levels. Level 1 to 5. The Level might increase from 1 to 2 in a month or 2 or even more. Lets say a metric Category 1 and Subcategory1 is Level 1 in Jan. We will get this data. The next time we get the data is when it changes to Level 2. Lets say it happens in March. So I need to show Level 1 in Jan and Feb. And Level 2 from March.

       

      In the output table, I am summarising how many metrics are in level 1 to level 5 in each month.