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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Connell
Regular Visitor

Measure for One Table Being Used for All Items

Hi,

So I have a structure that looks like

DataSet1

A10
B12

connected via first column, DataSet 2

A

A-1

25

AA-265
BB-120
BB-215

And once again DataSet3 connected to 2 via column 1

A-1A-1-1global 
A-1A-1-2universal 
A-1A-1-3global 
A-2A-2-1local 
A-2A-2-2universal 

 

And I have this DAX measure NotGlobal:

Not Global =
VAR notglobal = CALCULATE(
COUNT('DataSet3'[Column3]) +0,
Return notglobal

I need to create a table with the data in DataSet2 and DataSet1, but when I use my NotGlobal measure, it will assign 0 to things outside of DataSet3, but I only want it to assign 0 to things in DataSet3 even when I pull from the other 2. I need something like
variable1data1variable2data2NotGlobal
A10A-1252
A10A-2650
B12B-120 
B12B-215 

But instead it is giving me 
variable1data1variable2data2NotGlobal
A10A-1252
A10A-2650
B12B-1200
B12B-2150
Even though the B data doesnt exist in DataSet3

1 ACCEPTED SOLUTION

@Connell 

Ok. Would you please try

Global =
IF (
NOT ISEMPTY ( 'DataSet3' ),
SUMX ( 'DataSet3', IF ( 'DataSet3'[Column3] = "global", 1, 0 ) )
)

View solution in original post

9 REPLIES 9
v-chenwuz-msft
Community Support
Community Support

Hi @Connell ,

 

Please try this expression:

Measure =
IF (
    ISBLANK ( COUNT ( 'DataSet3'[Column3] ) ),
    BLANK (),
    COUNT ( 'DataSet3'[Column3] ) + 0
)

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

tamerj1
Super User
Super User

Hi @Connell 

you may try

 

 

Global =
SUMX ( 'DataSet3', IF ( 'DataSet3'[Column3] = "global", 1, 0 ) )

 

 

my problem is that all of the items not in that data set are taking on the calculation when a table is created using variables of another dataset, some of which are shared and some of which are not. The ones that are not shared, I thought, shouldn't take on the calculation, but they do and recieve a 0

@Connell 

Ok. Would you please try

Global =
IF (
NOT ISEMPTY ( 'DataSet3' ),
SUMX ( 'DataSet3', IF ( 'DataSet3'[Column3] = "global", 1, 0 ) )
)

I was able to adapt this to my powerBI and it works. Thank you very much for your help.

amitchandak
Super User
Super User

@Connell , That is because of +0, plus 0 will add 0 for all row having blank

 

remove +0 and try this

 

ShowItemwithoutdata.JPG

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

Thanks @amitchandak,
I want to actually indicate 0 for the items that are just in DataSet3. If I remove the 0, then they will be blank, along with other items not in DataSet3, so I won't be able to distinguish them. So if I do show items with no data, that doesn't solve what I am trying to do. I hope that adds some clarity.

@Connell 

What we need to do is push the filter to restrict 0 only for dataset3

 

Not Global =
VAR notglobal = CALCULATE(
COUNT('DataSet3'[Column3]) +0,
Return calculate( notglobal, filter('DataSet3','DataSet3'[Col1] = max('DataSet2'[variable2])))

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

I tried to make the adjustments and it was unsuccessful, everything is still showing 0. Perhaps because of the relationship it just picks up the calculation regardless?

Helpful resources

Announcements
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.