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

Scalar Value, dealing with text convert DAX Table to Measure

Hi Community,

 

I could create a table with this:

 

NewTable = SUMMARIZE(tableA, TableA[Shift1], "NewColunm", DISTINCTCOUNT(TableA[ProductionBtach]))

 

Everithing good, but when I tried to use as Measure, I got "multiple columns cannot be converted to a scalar value". So my question is how to transform DAX above to be used as measure? both colunms are text.

 

1 ACCEPTED SOLUTION

Hi @v-zhangti I forgot to close this topic I figured out using another method, in my calculation I did the "removefilters" and it worked as expected. Thanks for your time, this the expected result.

 

 

 Aucesar_1-1693221864248.png

 

View solution in original post

9 REPLIES 9
Semaj06
Regular Visitor

Hi

 

You cannot use it as a measure, you are returning 2 columns and with a measure you have to return only 1 value.

If you want to claculate, just do a measure with the countrows part and just publist the shift colum on the display and your new measure.

Aucesar
Helper III
Helper III

Hi @vicky_ sorry, didn´t put any date, basically as below:

 Shift1Shift2Desire Result
ProductionBatchWorkerWorker2EmployeeProductionBatch-Worked
A1LoisReggieLois2
A1LoisReggieReggie3
A1ReggieLoisDannie2
A1DannieLois  
B1LoisReggie  
B1ReggieLois  
B1ReggieLois  
C1ReggieDannie A1
C1DannieReggie  
C1ReggieDannie  
C1DannieReggie  
A1LoisReggie  
A1LoisReggie  
A1ReggieLois  
A1DannieLois  
B1LoisReggie  
B1ReggieLois  
B1ReggieLois  
C1ReggieDannie  
C1DannieReggie  
C1ReggieDannie  
C1DannieReggie  

Hi, @Aucesar 

 

You can try the following methods.

Measure = Var _table=SUMMARIZE(TableA, TableA[Worker], "NewColunm", DISTINCTCOUNT(TableA[ProductionBatch]))
Return
MAXX(_table,[NewColunm])

vzhangti_0-1692625163518.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hi @v-zhangti put sample data, with comments, if you could take a look, your data sample and example, worked for colum Worker1 but when I use on worker2 in the real data, doesn´t worked as expected;
Give a try when possible;
https://1drv.ms/u/s!AktM4_8VYySOiJMb5iee9iC3tU0cpA?e=3Okqh1

Hi, @Aucesar 

 

You can try the following methods.

Measure 1 = Var _table=SUMMARIZE(Refugo, Refugo[Ajudante],Refugo[Numero Fusao], "NFusoesAjudante", DISTINCTCOUNT(Refugo[Numero Fusao]))
Return
SUMX(_table,[NFusoesAjudante])
Measure 2 = Var _table= SUMMARIZE(Refugo, Refugo[Moldador],Refugo[Numero Fusao], "NFusoesMoldador", DISTINCTCOUNT(Refugo[Numero Fusao]))
Return
SUMX(_table,[NFusoesMoldador])

vzhangti_0-1692690598214.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Hi, @v-zhangti not yet, if I do the sum from both measure values are not correct;

Aucesar_0-1692702350281.png

Also as the real data is available now, we could try using Refugo Table which is the main table, fell free , any help is welcome!

Hi, @Aucesar 

 

What is the correct total value you expect?

 

Best Regards

Hi @v-zhangti I forgot to close this topic I figured out using another method, in my calculation I did the "removefilters" and it worked as expected. Thanks for your time, this the expected result.

 

 

 Aucesar_1-1693221864248.png

 

vicky_
Super User
Super User

Like you said, you're creating a table with that DAX function you've written. 

If you need it to display as a measure in a table, you need to tell powerBI how to summarize the table to return only 1 value. Without more specifics, it's hard to tell you how to summarize it, but you can use functions such as MAX, COUNT, etc. 

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.