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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
avcr29
Frequent Visitor

create a measure that combine column values and measures based on a type column

Hello!,

 

I need help please, i'm trying to combine, in a new table, data from two tables, where in table 1 i have a column X,  and on table 2 i have a measure called Xmeasure. This two values (X measure and X column) represent the same but the measure is type 1 and the column is type 2. I create a new table where i've used the function union and summerize to combine the columns in common from this two tables (date,type) so i can later make another measure (weigthed average per category) and then a rolling average  based on the date.

So this is what i have:

Table 1

Date (Month)TypeX column
Marchtype 155%
Maytype 1 

 

Table 2

Date (Month)TypeX measure
Marchtype 2-0%
Maytype 2 -Infinity

 

And this is what i want to create:

 

Table 3 (New Table)

 

Date (Month)Type
Marchtype 155%
Marchtype 2-0%
Maytype 1 
Maytype 2-Infinity

 

As you can see, the values of month May are blank (column) or with infinity value (measure) , this will happen because there are other columns (that are not shown here) that are filled, that's why may exists, but this values in particular are not filled yet, tho eventully May is going to be filled. 

 

i have created a measure to get X  in table 3 like this:

X =SWITCH(FIRSTNONBLANK('Table 3'[Type],1),"type 1",FIRSTNONBLANK('Table 1'[X column],1),"type 2",CALCULATE('Table 2'[X measure]))

 

but this doesn't bring the correct result. i know that FIRSTNONBLANK function is not the correct one for what i want to do because it will repeat the value of the non blank row and it doesn't distinguish the correct values per month but i don't know what other function could read a column in a measure.

 

i don't know if there's another formula that i can use to get the result i want. 

 

Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @avcr29,

 

Nope, this measure is based on specific row content, when you use it in tachometer, measure can't get correspond result for summary records.

 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @avcr29,

 

You can try to use following formula to get related result if it works for your scenario:

result =
VAR _currType =
    SELECTEDVALUE ( Table3[Type] )
VAR _currMonth =
    SELECTEDVALUE ( Table3[Date (Month)] )
VAR temp =
    ADDCOLUMNS ( Table2, "X measure", [X measure] )
RETURN
    IF (
        _currType = "type 1",
        LOOKUPVALUE (
            Table1[X column],
            Table1[Date (Month)], _currMonth,
            Table1[Type], _currType
        ),
        IF (
            _currType = "type 2",
            MINX (
                FILTER ( temp, [Date (Month)] = _currMonth && [Type] = _currType ),
                [X measure]
            )
        )
    )

If above not help, please share more detail information about your formulas.

 

Regards,

Xiaoxin Sheng

Hi @Anonymous,

 

Thank you for your reply, i've tried the formula and i think it's almost there when i put it in a table the result is like this:

Date(Month)Typeresult
Marchtype 155%
Marchtype 2-100%
Maytype 10%
Maytype 20%

 

i think the minx function is the reason why the result in march type 2 is -100% instead of -0%.  That's why i change it a little bit :

 

result =
VAR _currType =
    SELECTEDVALUE ( Table3[Type] )
VAR _currMonth =
    SELECTEDVALUE ( Table3[Date (Month)] )
VAR temp =
    ADDCOLUMNS ( Table2, "X measure", [X measure] )
RETURN
    IF (
        _currType = "type 1",
        LOOKUPVALUE (
            Table1[X column],
            Table1[Date (Month)], _currMonth,
            Table1[Type], _currType
        ),
        IF (
            _currType = "type 2",
            CALCULATE(if(and([x measure]>-1,[x measure]<0),0,[x measure]),
FILTER ( temp, Date(month) = _currMonth && [Type] = _currType ) ) )

 

there i get the wright result, tho when i try to use this measure in a tachometer it shows blank, how can fix this?

 

Thanks!

 

Anonymous
Not applicable

Hi @avcr29,

 

Nope, this measure is based on specific row content, when you use it in tachometer, measure can't get correspond result for summary records.

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.