Forum Discussion

ghouse_peer's avatar
ghouse_peer
Post Patron
2 years ago
Solved

Default value - Current Month Value

Hi Team,

 

I have  a requirement.

 

I have a card Visual. and Slicer for month.

 

1.when i open report, in a card visual it should show current month value as default.

2. when we select month in slicer it should filter accoordingly.

 

please help

 

Thanks in advance

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ghouse_peer ,

    Below is my table:

    The following DAX might work for you:

    Measure 1 = 
        SELECTEDVALUE('Table (2)'[Reporting])
    Measure 2 = 
      var dat1 = MONTH(TODAY())
      var dat2 = MONTH('Table (2)'[Measure 1])
      var result =
      CALCULATE(
             MIN('Table (2)'[MothValue]),
             FILTER('Table (2)',dat2 = dat1)
        )
      var result2 = 
       CALCULATE(
             MIN('Table (2)'[MothValue]),
             FILTER('Table (2)',dat2 <> dat1)
        )
      var result1 =
        IF(dat1 = dat2 , result , result2)
    return result1

    The final output is shown in the following figure:

    Best Regards,

    Xianda Tang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

3 Replies

  • Thennarasu_R's avatar
    Thennarasu_R
    Responsive Resident

    Hi ghouse_peer 

    Try this Measure,

    Measure= Var __AA=Calculate(Sum(Value column),Dimdate(Month)=Month(Today()))
    Return
    If(selectedvalue(Dimdate(Month)),Calculate(sum(value column),__AA))

    Thanks ,
    Thennarasu R

    • ghouse_peer's avatar
      ghouse_peer
      Post Patron

      Not working!!

       

       

      Reporting MonthValue
      Aug-23-1.0
      Spe-23-2.8
      Oct-23-3.2

       

      So now when i select card visual and take value in that and Reporting Month in slicer. At first it should show Oct-23 value i,e -3.2 without selecting any value in slicer.

       

      But when we select month in slicer it should show value accordingly. Please check

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ghouse_peer ,

    Below is my table:

    The following DAX might work for you:

    Measure 1 = 
        SELECTEDVALUE('Table (2)'[Reporting])
    Measure 2 = 
      var dat1 = MONTH(TODAY())
      var dat2 = MONTH('Table (2)'[Measure 1])
      var result =
      CALCULATE(
             MIN('Table (2)'[MothValue]),
             FILTER('Table (2)',dat2 = dat1)
        )
      var result2 = 
       CALCULATE(
             MIN('Table (2)'[MothValue]),
             FILTER('Table (2)',dat2 <> dat1)
        )
      var result1 =
        IF(dat1 = dat2 , result , result2)
    return result1

    The final output is shown in the following figure:

    Best Regards,

    Xianda Tang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.