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
Sania-F
Resolver I
Resolver I

In a textbox dynamically display all country names where a measure% > 0

I have a dim country table with column "country name", I have a measure table with measure as "EVA%". I need to dynamically display all country names in a text box wherever the EVA% is greater than 0. There is no relationship between measure table and dim country table.

I tried using below DAX in measure table , but getting error as -'EVA%' is not recognized or available in the current context.

.
after googling realized that , MAX function doesnt take measure but takes column only.

   ```DAX

   EVA% Greater Than Zero = IF(MAX('MeasureTable'[EVA%]) > 0, 1, 0)

   ```

 

 I tried to write DAX in measure table as below, but still getting same error -

```DAX

EVA% Greater Than Zero =

IF(

    ISFILTERED('CountryTable'[Country Name]),

    IF(

        CALCULATE(MAX('MeasureTable'[EVA%])) > 0,

        1,

        0

    ),

    IF(

        MAX('MeasureTable'[EVA%]) > 0,

        1,

        0

    )

)

```

 

Created below as calculated column in country table-it is not working and giving same error -

   ```DAX

   EVA% Greater Than Zero =

   VAR MaxEVA = CALCULATE(MAX('MeasureTable'[EVA%]), 'CountryTable'[Country Name] = EARLIER('CountryTable'[Country Name]))

   RETURN

   IF(MaxEVA > 0, 1, 0)

   ```

Below 2 DAX's is not gibving error but it is not working, its not returning anything -

EVA%_Max = MAXX('Measure Table', [EVA%])
EVA%_Max_greaterthanZero = IF([EVA%_Max ]>0, 1,0)

Please help me with a work around.

Thankyou in advance

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Sania-F 

 

Not sure if I understand it correctly. Below is my example. To display some dynamic values in a textbox, you need to create a measure to calculate the dynamic value. In addition, as a measure returns only one scalar value, you have to concatenate all filtered countries into a value. So I use CONCATENATEX function

vjingzhanmsft_0-1717056524132.png

Without knowing your MeasureTable's structure, I assume that it has [CountryName] column too, so I filter MeasureTable and use its Country Name column in my sample measure. You may have to adjust it according to your data model. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

6 REPLIES 6
Sania-F
Resolver I
Resolver I

After n no. of hits and trials the below DAX worked out. 
So, I created a new mesaure in my measure table as follows -

```DAX

CountryList_EVA_Positive =

    CONCATENATEX(

        FILTER(

            VALUES('dimCountry'[Country]),

            [EVA%] > 0

        ),

        'dimCountry'[Country],

        ", "

    )

Finally I dynamically inserted this CountryList_EVA_Positive measure in text box, and it worked as expected. 
------------------------------------------------------------------
Just to reiterate the problem statement - In power Bi, I have a measure table which has only measures. I have a dimension table with country column. These 2 are not at all connected in any way, no relationship, no common columns. There is a measure called "cci%" Now my requirement is -In a text box, I want to be able to get all country names from dimCountry where the cci%>0.


Anonymous
Not applicable

Great! You have created an elegant measure to solve this problem!

Anonymous
Not applicable

Hi @Sania-F 

 

Not sure if I understand it correctly. Below is my example. To display some dynamic values in a textbox, you need to create a measure to calculate the dynamic value. In addition, as a measure returns only one scalar value, you have to concatenate all filtered countries into a value. So I use CONCATENATEX function

vjingzhanmsft_0-1717056524132.png

Without knowing your MeasureTable's structure, I assume that it has [CountryName] column too, so I filter MeasureTable and use its Country Name column in my sample measure. You may have to adjust it according to your data model. 

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Hi @v-jingzhan-msft ,

Thankyou for your response. My measure table does not have country column. Only the dimcountry table  has "country" column. And there is no relationship between "measure table" and " dimcountry" table. So how can I concatenate country names now? 

Anonymous
Not applicable

@Sania-F 

Does the Measure Table has other column like Country ID or something similar that also exists in DimCountry table? 

 

You can try this new measure. Assume that you only have Country code in measure table, you can filter measure table to have those country codes whose EVA% are greater than 0, then use these country codes to filter DimCountry table to find the corresponding country names and concatenate them finally. TREATAS function can be used when a relationship does not exist between the tables.

EVA% Greater Than Zero 2 = 
var _countryCodes = SELECTCOLUMNS(FILTER(MeasureTable,MeasureTable[EVA%]>0),"country_code",'MeasureTable'[Country Code])
return
CALCULATE(CONCATENATEX(DimCountry,DimCountry[Country Name],", "),TREATAS(_countryCodes,DimCountry[Country Code]))

 

Best Regards,
Jing

HI Jing,

unfortunately my measure table and dimension table do not have anything in common 😞

So I was struggling with writing DAX for my requirement.Found a workaround for this situation. 

I observed that your pbi has EVA% as a column, but in my case it was a measure that was calculated based on xyz values. And the measure doesnt store data, which means we cannot use eva% measure directly inside FILTER function of DAX to filter values. So had to use it along with other DAX function.

Thanks a lot for your help. It redirected me towards my solution.

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!

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.

Top Solution Authors
Top Kudoed Authors