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
bolabuga
Helper V
Helper V

query editor calculation.

Capturar.PNG

 

Hello, i would like some help, im trying to do the following on the query editor.

 

as shown on the screenshot for the columns, i need to do:

 

[sum of consumes] divided [sum of homes] filtered when [type = "R"] and [ identification = "condominios" ]

 

thks.

9 REPLIES 9
BhaveshPatel
Community Champion
Community Champion

You can use something like this and once you get your desired column, you can do some either using Invoke Custom Function or Custom Column.

B1.PNG

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Thks Bhavesh, but i dont think i can use that example.

 

Because the columns that i need to divide have lots of differents values, or at least im not seeing how this would apply to my case where i want 1 value across all rows in a new column, and this value is the result of the formula above.

I would suggest then that you keep things simple and do it step by step rather than in one task.

 

Make a calculated column:    sumC = Sumx(Table,Field)

Make a calculate column:      sumH = Sumx(Table,Field)

 

this allows you to visually verify

 

then make a calculated column: Final = IF([type] = "R" AND [identification] = "condominios"),sumC/sumH,0)

 

 

www.CahabaData.com

Interesting approach, i will test to see how things look like with this. I actually did all in one go with "calculate", "divide" and "filter", but the way you suggested is simpler.

 

Any way, thks both cahaba and bavesh, to learn how to use chains of DAX commands in powerquery i will probably need to do a online course or something that is more time consuming. I just read "Power Query Formula Language Specification (August 2015)", but its all CLOUDY right now hauahuah.

@bolabuga

 

Have you got this problem solved with CahabaData’s solution?

 

Best Regards,

Herbert

 

actually my suggestion renders a different value per row - - and am not sure that is what you seek based upon our original exchange. 

www.CahabaData.com
CahabaData
Memorable Member
Memorable Member

You seek a single value - that is displaying in a new column - and that single value is the same on every row?

 

If not please clarify with an example of a few rows that are your goal.

www.CahabaData.com

Xiauxian posted a solution on my other thread, using DAX commands.

 

http://community.powerbi.com/t5/Desktop/Creating-a-newer-table-based-on-data-of-existing-calculated/...

 

However, if i can learn to do the some calculations on the query editor, more knowledge are always good :).

yes cahaba, thats exactly what i seek **1 value on every row**, in truth i need to do several calculations with single results, because i need the average results of a year, for some indicators.

 

The example above would cover me for every calculation that i need to do, because everything uses the same pattern in the calculations, just the filters would be different.

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.