Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AnAnalyst
Helper III
Helper III

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors