Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
I would appreciate your help with this.
Below is a screenshot of a report I am working on. I only have the cost for products beginning with "L", yet every product has the "Avg Cost 1" and "Avg Cost 2" populated with a value. I would like any product beginning with some value other than "L" to be blank or have "0" if needed. Avg Cost 1 and Avg Cost 2 are for different date ranges. I have added the "ADJ COST 1" measure to try and limit where the cost shows. Here is the latest iteration of DAX I have tried to accomplish my goal.
But as you can see in the below screenshot all products still have a value for cost in the "ADJ COST 1" column.
Here is the DAX I am using for Average Cost.
Solved! Go to Solution.
@BudMan512 Try:
ADJ COST 1 =
VAR __Category = MAX('Sales'[CATEGORY])
VAR __First = LEFT(__Category, 1)
VAR __Result = IF( __First = "L", [Avg Cost 1], BLANK())
RETURN
__Result
@BudMan512 Try:
ADJ COST 1 =
VAR __Category = MAX('Sales'[CATEGORY])
VAR __First = LEFT(__Category, 1)
VAR __Result = IF( __First = "L", [Avg Cost 1], BLANK())
RETURN
__Result
Greg,
Thanks so much for taking the time to answer my post. The solution worked perfectly. In fact I was able to modify that measure for 8 other columns. It cleaned up my report nicely.
I have two of your books and read them as I have time. I am an old man (72) in a young mans game but still enjoy it for the most part except when I run into a problem like this. Thankfully there are people like you who are happy to help. Best Regards, Bud
@BudMan512 It's my pleasure!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
25 | |
12 | |
9 | |
9 | |
9 |
User | Count |
---|---|
21 | |
14 | |
14 | |
13 | |
13 |