Forum Discussion
Help with complex Measures and Calculated columns
Hi Guys,
I'm trying to achive the same as the attachment which in excel, but in Power BI. I'm really struggling to get these to duplicate, esepcially getting a total of the Negative Values. Can anyone help?
Power BI Table is called 'Dealbook'
COLUMN E IS COLUMN D DIVIDED BY C
COLUMN G IS COLUMN F DIVIDED BY C
COLUMN H IS THE AVERAGE FIGURE FROM CELL G14
COLUMN I IS COLUMN C MULIPLIED BY COLUMN H
COLUMN J IS COLUMN I MINUS F
COLUMN K IS THE NEGAIVE VALUES FROM COLUMN K
CELL K 14 IS THE TOTAL OF THE NEGATIVE VALUES FROM COLUMN K
ALL NEED TO WORK AND CHANGE BASED ON THE SLICERS SELECTED
Hi craigmon
Please use these measures,
1.Measure = sumx(SUMMARIZE(Dealbook,Dealbook[Location1],Dealbook[Sales Exec],"x",[01 Negative Diff Only Measure]),[x])2.
01 Neg Diff Only Measure New = if([01 PPU Diff Measure]<0,[01 PPU Diff Measure],if(HASONEVALUE(Dealbook[Location1]),[Measure])) --- add this to your visual to get the valuesPlease mark this as solution if it resolves your problemThanks,Rajashri N
9 Replies
- raji_nResolver II
Can you please share a mock excel data craigmon
for column e,g you can use divide function in DAX
Column h, use all function to return the average value,
Column i cna use the * operator to multiply
Column k, do an if loop to check for negative values, IF([YourColumnName] < 0, [YourColumnName],0)
Cell k14, do a sum by applying abs()
Let me know if this helps.
- craigmonHelper I
https://drive.google.com/drive/folders/1XxniIRgYwkogkolvIIDNvkw-1zpZxx4Z
Here you go, link to excel file
- srlabheSuper User
Hi,
Please try to have base columns as Measures created in PBI
For Ex to calculate Column E, please create a Measure for Column D & C and use DIVIDE function.
Same for Column G, Column I, Column J
For Column H = AVERAGEX(ALL('YourTable'), 'YourTable'[Column G])
Column K= Calculate(<<column J Measure>>, column J Measure<0)
K14= Calculate(<<column K Measure>>, column K Measure<0)
Hope this helps
- v-kpoloju-msftCommunity Support
Hi craigmon,
Thank you for reaching out to the Microsoft fabric community forum. Also, thanks to srlabhe, raji_n, for those inputs on this thread. I reproduced the scenario, and it worked on my end. I used my sample data and successfully implemented it.
I am also including .pbix file for your better understanding, please have a look into it.
Hope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Fabric Community Forum.
- craigmonHelper I
Many thanks for the reply, really appreciate you looking into this. However, its not quite what I was looking for. I've managed to create all of the measure in my pbix example below, but for some reason the 01 Negative Diff Only Measure does not show a total, it only shows 0. I need this to be the same as K14 in the example above. Many thanks
https://drive.google.com/drive/folders/1XxniIRgYwkogkolvIIDNvkw-1zpZxx4Z
- raji_nResolver II
Hi craigmon
Please use these measures,
1.Measure = sumx(SUMMARIZE(Dealbook,Dealbook[Location1],Dealbook[Sales Exec],"x",[01 Negative Diff Only Measure]),[x])2.
01 Neg Diff Only Measure New = if([01 PPU Diff Measure]<0,[01 PPU Diff Measure],if(HASONEVALUE(Dealbook[Location1]),[Measure])) --- add this to your visual to get the valuesPlease mark this as solution if it resolves your problemThanks,Rajashri N