cancel
Showing results for 
Search instead for 
Did you mean: 
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

 

 





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


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

 

 





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




View solution in original post

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





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


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 III
Super User III

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

 





If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




amitchandak
Super User IV
Super User IV

@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)

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors
Users online (2,525)