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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
oracledw
Regular Visitor

Measure behavior based on grid columns

Hello,

I'm new to Power BI.

I have a measure called COSTING = SUM(TABLE1.COST)

 

Use Case:

When users drags City from the Location Dimention, then do not add up the cost if ID is -1, so I modified my measure

as follows:

COSTING = CALCULATE(SUM(TABLE1.COST), FILTER (LOCATION.ID <> -1) works file

Here is the issue, but if user drags STATE (coming from the same Loaction Table) in the same grid then I want COSTING measure to ignore LOCATION.ID <> -1, behave like COSTING = SUM(TABLE1.COST)

 

What can I do to make meassure work

 

Here is the screen shot of what I'm looking for.1.png

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

HI  @oracledw 

Please share your sample pbix file for us have a test, that will be a great help.

which field is used to create a relatonship between TABLE1 and Location table?

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@oracledw , isfiltered /isinscope should able to help you.

 

like

Measure =
SWITCH (
TRUE,
ISINSCOPE ( Table[State] ), [Costing],
ISINSCOPE ( Table[City] ), [Costing1],
blank()
)

 

refer this example if this can help

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Greg_Deckler
Super User
Super User

@oracledw - You will need to ISINSCOPE or HASONEVALUE to determine where you "are" and calculate appropriately based on that. Can you post sample data and expected output as text in a table?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_DecklerI provided the image in above post.

@oracledw - Yeah, hand entering data sucks. I don't like to do it if the poster can paste as text and I can copy/paste.

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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