cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AnAnalyst
Helper II
Helper II

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

Data Sample.PNG

 

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 3
Nathaniel_C
Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

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)

 

 

 

 

 

kpi.PNG

 

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Winner of T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Find out who won the T-Shirt Design Challenge and the top 3 finalists.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.