Forum Discussion

RCro's avatar
RCro
Frequent Visitor
2 years ago
Solved

Creating a dynamic card visual

Hello all! I have a matrix with Turnover broken down by Date (Year/Month in the rows) and Customer Sales Segment (1-4 based on their purchases, in the columns). I am trying to create a dynamic ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hello RCro 

     

    Based on your description, you want to display the difference in Turnover between a selected month for a specific customer sales segment and the previous month for the same segment. To achieve this, you can use DAX measures to calculate the difference dynamically based on the selection in the matrix.

     

    Here's a step-by-step guide to create the dynamic card visual:

     

    1. Create a Measure for Previous Month Turnover

    PreviousMonthTurnover = CALCULATE(SUM(YourDataTable[Turnover]),DATEADD('Date'[Date],-1,MONTH))

    I suggest adding a Date table as DATEADD functions expects a Date column which has continuous dates. 

     

    2. Create a Measure for Selected Month Turnover

    SelectedMonthTurnover = SUM(YourDataTable[Turnover])

     

    3. Create a Measure for Turnover Difference

    TurnoverDifference = [SelectedMonthTurnover] - [PreviousMonthTurnover]


    4. Add a Card Visual to the Report and drag the TurnoverDifference measure into the Field well of the Card visual.

     

    I have attached a sample file at bottom. 

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!