Forum Discussion

WAB_Reports's avatar
WAB_Reports
Icon for Helper I rankHelper I
5 years ago
Solved

Dynamic clustered column chart and single card, with a default month selected?

Hello all,   This may be something very simple (I hope), but I can't seem to get it to do what I want. I have the following charts created:   1 - clustered colum chart in detail of what I wan...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi WAB_Reports 

    Due to I don't know your data model, I build two sample tables to have a test.

    Budget Table:

    Add a YearMonth column in this table.

    YearMonth = YEAR(Budget[Date])*100+MONTH(Budget[Date])

    Spend Table:

    Add a YearMonth column in this table.

    YearMonth = YEAR(Spend[Date])*100+MONTH(Spend[Date])

    Build a slicer by Budget[YearMonth] column and build measures to achieve your goal.

    Spend = SUMX(FILTER(Spend,Spend[YearMonth]=MAX(Budget[YearMonth])),Spend[Spend])
    Total = 
    VAR _Default = SUMX(FILTER(Spend,Spend[YearMonth] = YEAR(TODAY())*100+MONTH(TODAY())),Spend[Spend])
    VAR _Select = SUMX(FILTER(Spend,Spend[YearMonth] = SELECTEDVALUE(Budget[YearMonth])),Spend[Spend])
    Return
    IF(ISFILTERED(Budget[YearMonth]),_Select,_Default)

    Build a stacked column chart by Category column and Total measure.

    Build a cluster column chart by Budget[Date], Spend measure and Budget column.

    Result is as below.

    By default, it will show values in current month.

    Select YearMonth in slicer.

    You can download the pbix file from this link: File

     

    Best Regards,

    Rico Zhou

     

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