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
Analitika
Post Prodigy
Post Prodigy

Calculate measure by column value in Power BI

Hello,

 

I have a table. I want to calculate a measure which checks if column A =0, the calculate(sales), else values comes from A column

How to implement this?

5 REPLIES 5
Signore_Ands
Advocate II
Advocate II

Hello @Analitika 

Could you add a Conditional Column, in the Query Editor, like this?

Signore_Ands_0-1654090785218.png


And then sum the new column?

Or am I missing part of the requirement?

Analitika_0-1654091642914.png

I need to make a measure which calculates like this: if column r =0, then Pardavimai DK+-50_5 else column[r].

Hi @Analitika ,

 

If you want to judge the column r if equal 0, you need the measure of this column r. It may be sum('table'[r]) or max('table'[r]). In any case, fields in digital format must be the result of aggregation in the table visual.

 

Based on this. measure should look like this.

 

Measure = 

IF( SUM('Table'[r]) = 0 , SUM( 'Table'[Pardavimai DK+-50_5]), SUM('Table'[r]) )

 

Best Regards

Community Support Team _ chenwu zhu

 

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

Sales is not a column it is a measure

what column is Sales based on?

would this work?

Calc_Sales =
VAR vColA = CALCULATE(SUM(Table1[Column A]), fiLTER(Table1,Table1[Column A]<>0))
VAR vColSales = CALCULATE(Table1[Sales], fiLTER(Table1,Table1[Column A]=0))

RETURN
vColA+vColSales

Signore_Ands_0-1654092140722.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.