Forum Discussion

AnAnalyst's avatar
AnAnalyst
Icon for Helper III rankHelper III
6 years ago

DAX Filter by Measure at Project level Context

Hello,

 

I am trying to create a measure that will give me the KPI Measure value from the below table:

  1. YTD Plan minus YTD Forecast > 0
  2. Full Year Plan minus Full Year Forecast < 0
  3. It will respect the date slicer

 

In short I want to put the -50 value in a card KPI or other charts, but I need the meausre to respect the project context and the date slicer. 

 

Any help is much apprecited. 

 

Thank you

3 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Icon for Community Champion rankCommunity Champion

    Hi AnAnalyst ,

    Try this:

     

     

    IF ([YTD Variance]>0 && ([FY Variance] <0, [FY Variance] ,0)

     

    Please let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

    • AnAnalyst's avatar
      AnAnalyst
      Icon for Helper III rankHelper III

      This works if I put that formula in the matrix since the context is respected due to the project number being in the matrix. However, I need the measure to define the context so I can put the measure in other visuals. 

       

      Currently I am simply adding the visual level filters to the matrix to exclude KPI Measure = 0.

      • Nathaniel_C's avatar
        Nathaniel_C
        Icon for Community Champion rankCommunity Champion

        Hi AnAnalyst ,

         

        So you can drop that into your table, or create the column in Power Query, which is the best place to do it. As you can see it can be drop on a card, or you can create a simple sum of the column and drop that on the card as well.

         

        If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
        Nathaniel

         

        = Table.AddColumn(#"Changed Type1", "KPI PQ", each if [YTD Variance] > 0 and  [Fy Variance] < 0 then [Fy Variance] else 0)
        
        KPI Measure = sum(KPIMeasure[KPI])
        
        KPI = IF(KPIMeasure[YTD Variance]>0 && KPIMeasure[Fy Variance] <0, KPIMeasure[Fy Variance],0)