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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Augustas-ase
Helper II
Helper II

Formula

how to calculate and get percentages in a column?

Augustasase_0-1686306955917.png

 

31 REPLIES 31
darkinvader
Frequent Visitor

If you're already have measure for _sumOfSales  then just replace _sumOfSales  with your measure. Here in the above calculation "ALL" is playing the major role which will sum all the value regardless of the columns, so no need to worry about summing it.

i cant use sum in the formula:

var _sumOfSales = Sum(Test(Sales 2022) , becouse Sales 2022 is Measure, and i cant to choice it

Hi @Augustas-ase ,

this what you can do I feel,

% Sales = 
var _sumOfSales = [Sales 2022]    <- your measure here.

var _percent = Calculate(_sumOfSales,ALL(Table'Category))

 

return

 

_sumOfSales/_percent

my formula: 

% Sales =
var _sumOfSales = [Sales 2022]
var _percent = Calculate(_sumOfSales,ALL(SALES[big grupe])
return
_sumOfSales/_percent
 
This is my formula, and i get error: The syntax for 'return' is incorrect. (DAX(var _sumOfSales = [Sales 2022] var _percent = Calculate(_sumOfSales,ALL(SALES[big grupe])return_sumOfSales/_percent)).
BIswajit_Das
Resolver III
Resolver III

Hello @Augustas-ase

If you want to view percentage on the matrix visual then you can also do this
w1.PNGw2.PNGw3.PNGw4.PNG

its cool, but how to get this in measure? 

Augustasase_0-1686309106611.png

i want to multiply it with forx example:  sales * %gt sum .....

and how to get a new measure with %??

BIswajit_Das
Resolver III
Resolver III

Hello @Augustas-ase here's something that may be helpfull
Q1.PNGQ2.PNG

all i get 100%

Augustasase_0-1686640375669.png

 

how to make, for example, that '2sale2s2' is calculated for each month 100% for each month, instead of for the whole year

Augustasase_1-1686641852796.png

 

Hello @Augustas-ase, So you want the percentage to calculated by each month!!!

yes

You can do that by
Modify your formula to
calculate (

expression,
filter(table,table[monthcol] = eariler(table[monthcol]))
)

what should it look like when you put it in this formula?

Sales =
VAR _total = sum('Planam'[Sales 2022])
return
_total

Sales =
VAR _total =
Calculate(

SUM('Planam'[Sales 2022]),
Filter('Planam','Planam'[month] = Earlier('Planam'[month]))

)
RETURN _total
try this out

 

maybe you know, how to write formula, then my data is in table for example: 

Augustasase_1-1686647144664.png

 

a result I get Sales 2022 using a different formula  %CT Sales 2022  this this column comes from SALES 2022

Augustasase_0-1686647061530.png

how do I get the measure so I can use it for other calculations?

You can use that column values as mesure values and can use it in other visuals.

but I want to get a separate percentage formula, make a new measure

Hi @Augustas-ase 

 

Have you solved this problem? If yes, you can accept an appropriate reply as solution or post your own solution. If not, you may refer to my sample file attached at bottom. Usually providing some sample data or sample file will make other users understand your data and expected result better. 

 

If you have a column [Sales] in table 'Table', you can try a measure like below. 

% of Sales = DIVIDE(SUM('Table'[Sales]),CALCULATE(SUM('Table'[Sales]),ALL('Table')))

 

If you already have a measure like [Sales Measure] which calculates the sum, you can create a new measure like 

% of Sales 2 = DIVIDE([Sales Measure],CALCULATE([Sales Measure],ALL('Table')))

vjingzhang_0-1689302611056.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

2Sale2s =
VAR _total = sum('Planam'[Sales])
var _val = 'Planam'[Sales]
return
_val/_total
 
should also be added here

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.