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
PVO1
Helper II
Helper II

DAX too complicated for me

Good day,

 

Looking for your help in creating a measure (not a column). Can't seem to figure it out at all.

This measure should do the 3 things listed below. I would like to use this in a measure together with the [ID] column in a visual.

- IF [Amount] = 0 then BLANK

- IF [N/W] = "W" then BLANK

- IF [Connection] = BLANK then [Amount] else (not sure how to explain, see below) CALCULATE(SUM([Amount]),ALL([Connection]))

 

Data is shown below with the expected result of the measure added. In my visual I would like to only use ID & Measure.

IDN/WAmountConnectionMeasure
1N100 100
2N0 BLANK
3N200 200
4N300a150
5W-150aBLANK
6N400b390
7W80bBLANK
8W-90bBLANK
1 ACCEPTED SOLUTION

Hi @PVO1 ,

 

A quick workaround for this can be having the following in the table visual:

Pragati11_0-1619110293906.png

 

Just hide the CONNECTION column in the table visual by adjusting the width of this column in table visual. 

Make sure to do the following before hiding the column:

Pragati11_1-1619110371588.png

 

Pragati11_2-1619110420301.png

Rename CONNECTION column to something like single character. I have renamed it to a dot "."

Pragati11_3-1619110497169.png

Now decrease the width of this column:

Pragati11_4-1619110546824.png

 

Hope this workaround helps.

 

Thanks,

Pragati

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

6 REPLIES 6
PVO1
Helper II
Helper II

@Pragati11 & @amitchandak 

Thanks a lot! Both of your calculations gave me the correct result. Unfortunatly I think I was not clear about the desired result. I would like to use this result in a table visual with only the ID & the measure.

So the visual would look like this:

ID   Measure

1     100

3     200

4     150

6     390

 

But perhapse I can figure this out on my own, with your input.

Hi @PVO1 ,

 

A quick workaround for this can be having the following in the table visual:

Pragati11_0-1619110293906.png

 

Just hide the CONNECTION column in the table visual by adjusting the width of this column in table visual. 

Make sure to do the following before hiding the column:

Pragati11_1-1619110371588.png

 

Pragati11_2-1619110420301.png

Rename CONNECTION column to something like single character. I have renamed it to a dot "."

Pragati11_3-1619110497169.png

Now decrease the width of this column:

Pragati11_4-1619110546824.png

 

Hope this workaround helps.

 

Thanks,

Pragati

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

HI @PVO1 ,

 

Can you please mark the other solutions with the DAX measure as the SOLUTION to this thread?
That is the actual soution to the query you asked. And the solution which you marked is an add-on solution to the issue.

 

Kindly mark the other one also as the solution to this thread.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thanks again!

Just spent a day trying to figure this out, to come to the conclusion that it's not possible with a measure. Think I'm going to add some columns to the dataset in order to create the desired result. 

Pragati11
Super User
Super User

Hi @PVO1 ,

 

You can write the following measure to achieve the result:

Pragati11_0-1619100707915.png

 

Adding the measure calculation as follows:

MeasureCalc =
var t1 = SELECTEDVALUE('Table (3)'[Amount])
var t2 = SELECTEDVALUE('Table (3)'[N/W])
var t3 = SELECTEDVALUE('Table (3)'[Connection])
var t4 = CALCULATE(SUM('Table (3)'[Amount]), ALLEXCEPT('Table (3)', 'Table (3)'[Connection]))
RETURN
SWITCH(
TRUE(),
t1 = 0, BLANK(),
t2 = "W", BLANK(),
t3 = BLANK(), t1, t4
)
 
Thanks,
Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

amitchandak
Super User
Super User

@PVO1 , try like

 

Measure =
var _1 = calculate(sum(Table[Amount]), filter(Table, Table[Amount] <>0 && [N/W] <> "W" ))
var _2 = calculate(_1, ALL(Table[Connection])
return
if(isblank(Max(Table[Connection])),_1, _2)

 

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.