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
ania_roh
Helper III
Helper III

problem with Dax measure

Hello,

I need some help in building my measure because I can´t find a way. I would be very grateful if you could help me.

So,

I have three columns (in the same table): column of localization_destino_original, column of localization_destino and number:

ania_roh_0-1673430545118.png

And now, I need to build a measure which would have two parts ( one of the localization_destino and the other localization_destino_original) but we would use it in visualization filtred only by localization_destino_original, like that:

ania_roh_1-1673430659581.png

Now, the measure would have two parts: Let´s say X and Y.

Measure = X + Y

So the X would be the like that (and it works):

X= SUMX(

    FILTER(

        Table,

            Table[LOCALIZACION_DESTINO] <> ANALISIS_ALBARAN2[LOCALIZACION_DESTINO_ORIGINAL]),

Number))

 

How can I calculate my Y, if I want to say it all around?  

I will explain it with an example:

ania_roh_2-1673430697840.png

 

 

I would be very appreciated if you help me.

Thank you a lot.

 

10 REPLIES 10
reginaldrucker
New Member

download.png

 yeah this will explain everything baby or my dear lady

Mahesh0016
Super User
Super User

@ania_roh Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Yes, @Mahesh0016, thank you.
I created powerbi sample but I don´t find a way to attach it here.
The table would be like that : (localizacion_destino, localización_destino_original, value)

 

111111111
234311112
234523453
764234564
345634565
111123436
234311117
764276428
111123459
7642458210

 

The measure  X would be like that: 

ania_roh_2-1673438086962.png

The visualization is like that: 

ania_roh_1-1673438058199.png

Now I need calculate Y (the next column in the visualization) and I don´t know how. 
For this example, for ID_destino = 1111, Y should give 15: 

ania_roh_3-1673438263335.png

Thank you a lot

 

hi @ania_roh 

Not sure if i fully get your, try to write the measure like this:

 

Y = 
VAR _dest = MAX(TableName[DestOrig])
RETURN
SUMX(
    FILTER(
        ALL(TableName), 
        TableName[Dest] = _dest
            &&TableName[DestOrig] <> _dest
    ),
    TableName[Value]
)

 

 

i tried and it worked like this:

FreemanZ_1-1673452125957.png

 

 

Ohhh I can´t believe it! @Freeman 

Thank you a lot

What if I want it to responde to other fields of the table? Like date and section, for example? 

Thank you 

 

hi @ania_roh 

that was something never mentioned, try like

Y =
VAR _dest = MAX(TableName[DestOrig])
RETURN
SUMX(
FILTER(
ALL(TableName[Dest], TableName[DestOrig] ),
TableName[Dest] = _dest
&&TableName[DestOrig] <> _dest
),
TableName[Value]
)

@FreemanZ no, it doesn´t work 😞

ania_roh_1-1673537917667.png

 

hi @ania_roh 

try like:

Y2 = 
VAR _dest = MAX(TableName[DestOrig])
RETURN
CALCULATE(
    SUM(TableName[Value]), 
    TableName[Dest] = _dest,
    TableName[DestOrig] <> _dest
)

this one takes filters on other column, like:

FreemanZ_0-1673579005349.png

FreemanZ_1-1673579017079.png

the sample dataset:

SectionDestDestOrigValue

A111111111
B111123436
C111123459
A234311112
B234311117
C234523453
A345634565
A764234564
B764276428
C7642458210

 

@ania_roh 

Y =
SUMX (
    FILTER (
        localizationTable,
        localizationTable[localizacion_destino] = 1111
            && localizationTable[localización_destino_original] = 1111
    ),
    localizationTable[value]
)

Mahesh0016_0-1673440740556.png

****************************************************************************************

_Y =
SUMX (
    FILTER (
        localizationTable,
        localizationTable[localizacion_destino] = 1111
    ),
    localizationTable[value]
)

Mahesh0016_1-1673440830274.png

 

 

@ania_roh  If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

Yes @Mahesh0016 but I want to have it for all rows of that visualizations. 

Not only for 1111 (I put it to give an example). 

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.

Top Solution Authors