Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I am working with the following DAX:
Petrol or Diesel =
VAR A =
ADDCOLUMNS (
'Parking Data',
"Petrol or Diesel",
IF (
[Petrol Price (£)] = SUM ( 'Data'[Amount] ),
"Petrol",
"Diesel"
)
)
RETURN
MAXX ( A, [Petrol or Diesel] )
The issue with this DAX is that it gives me a total of either "Diesel" or "Petrol". Please see below:
How do I stop the total from showing (for this column only)?.
Solved! Go to Solution.
Hi,
Try this measure
Petrol or Diesel = if(hasonevalue('Table'[ID]),if([Total]=1,"Petrol","Diesel"),BLANK())
Hope this helps.
@HamidBee can you share one drive/google drive, I don't like to use any other website. Sorry
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I was honestly about to get around to it. Opened the thread and I saw that someone provided a solution. Thanks anyway.
@HamidBee can you post the raw data and what you are trying to achieve?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
I can't share the exact file as it contains sensitive data but please find attached an example file I have created below:
https://www.mediafire.com/file/8j45jqb8uj41mzr/Example_File.pbix/file
You will see a visual of a matrix. The matrix has totals under each column. For the "Petrol or Diesel" column there is a total of "Diesel". What I'd like is for there to be no total to show for that column only.
Thanks in advance.
Hi,
Try this measure
Petrol or Diesel = if(hasonevalue('Table'[ID]),if([Total]=1,"Petrol","Diesel"),BLANK())
Hope this helps.
Thank you, this worked beautifully. I have never used the HASONEVALUE function. I had a read through the Microsoft documenation but I didn't fully understand it. In the code you have written is HASONEVALUE used to iterate through all of the IDs to determine if there is a unique value and if there is it returns blank?.
Thanks
You are welcome.