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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors