Forum Discussion

danielwhitmote's avatar
danielwhitmote
Frequent Visitor
3 years ago
Solved

Current month as default - slider

I am trying to make current month to be displayed as default in my visuals.

 

I tried modyfying:

Measure = IF(ISFILTERED(Table1[Month]),CALCULATE(SUM(Table1[sales])),CALCULATE(SUM(Table1[sales]),FILTER(Table1,MONTH(Table1[Date])= MONTH(TODAY()) && YEAR(Table1[Date])=YEAR(TODAY()))))

Without sucess.

 

Data table - SNC 

 

 

And I also have Date table- Date

 

 

 My measue is:

NCM Monthly: =
    CALCULATE( DISTINCTCOUNT ( SNC[NCM] ))
 
Any help would be greatly appreciated.
  • HI danielwhitmote ,

    Make sure that you have an entry in your Custom Date table for the Year Month in the format 'YYYY-MM'. Make sure you use a leading zero for the month part so it's always two digits like '2019-03'.

    Once that's in place create this column using DAX:

     

     

    Report Month = IF(MONTH(now()) = Month(DB_DIM_Dates[Date]) && YEAR(now()) = YEAR(DB_DIM_Dates[Date]), "Current Month", DB_DIM_Dates[Year-Month])

     

     

    This will set each day for the current month to 'Current Month' and every other date to their respective Year-Month setting. Add this to a slicer, make it list view and sort descending and as 'Current Month' comes last alphanumerical it appears at the top of the list. 'Current Month' can always be your default value with others available to select. This means that when you subscribe it will happily roll over into a new month etc. You can modify this approach for any date range etc you are interested in.

     

    refer:

    Solved: Current month default selection in Slicers, so tha... - Microsoft Power BI Community

    Solved: Slicer to select current month as default - Microsoft Power BI Community

    Best Regards

    Lucien

6 Replies

      • danielwhitmote's avatar
        danielwhitmote
        Frequent Visitor

        I using something like this however it still doesnt ruturn acceptable result

         

        NCM Monthly: =
        IF(
            ISFILTERED ('Date'[Date]),
            CALCULATE( DISTINCTCOUNT ( SNC[NCM] )),
            CALCULATE (( DISTINCTCOUNT ( SNC[NCM] ),FILTER(SNC), MONTH((TODAY())))))
  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    HI danielwhitmote ,

    Make sure that you have an entry in your Custom Date table for the Year Month in the format 'YYYY-MM'. Make sure you use a leading zero for the month part so it's always two digits like '2019-03'.

    Once that's in place create this column using DAX:

     

     

    Report Month = IF(MONTH(now()) = Month(DB_DIM_Dates[Date]) && YEAR(now()) = YEAR(DB_DIM_Dates[Date]), "Current Month", DB_DIM_Dates[Year-Month])

     

     

    This will set each day for the current month to 'Current Month' and every other date to their respective Year-Month setting. Add this to a slicer, make it list view and sort descending and as 'Current Month' comes last alphanumerical it appears at the top of the list. 'Current Month' can always be your default value with others available to select. This means that when you subscribe it will happily roll over into a new month etc. You can modify this approach for any date range etc you are interested in.

     

    refer:

    Solved: Current month default selection in Slicers, so tha... - Microsoft Power BI Community

    Solved: Slicer to select current month as default - Microsoft Power BI Community

    Best Regards

    Lucien