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
IlikePBI
Frequent Visitor

Multiply total measure by calculated column

Hello,

I'm started to use DAX and I need some help please.

Actualy I'm trying to multiply a measure which is a total of measure values obtained by using Removefilters function, by a calculated column (month number).

Measure : Baseline  = calculate(SUMX('FACT_NCM_QFRZ', IF(RELATED('MD_NCM_FREEZE'[Freeze name])="201912" && RELATED('MD_TIME'[ALV_YEAR])="2019",'FACT_NCM_QFRZ'[MEASURE_ONE]) ),REMOVEFILTERS(MD_TIME[Reporting Month Number]))

Column: Reporting Month Number = if(MD_TIME[MONTH]="?",99, VALUE(RIGHT(MD_TIME[MONTH],2)))

 

BaseLineWithoutRemoveFilters =
(SUMX('FACT_NCM_QFRZ',
IF(RELATED('MD_NCM_FREEZE'[Freeze name])="201912" && RELATED('MD_TIME'[ALV_YEAR])="2019",
'FACT_NCM_QFRZ'[MEASURE_ONE]) ))

YouPBI_0-1641291271291.png

I need to create a measure to calculate Baseline*Reporting month number

the target will be like : 

YouPBI_1-1641291789560.png

 

I have tried this :

FalseTarget =
sumx(FACT_NCM_QFRZ,[Baseline]*related(MD_TIME[Reporting Month Number]))

 

but I'm not getting the correct results

YouPBI_2-1641292040577.png

 

Thank you in advance for your help,

 

Best Regards,

 

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@IlikePBI Seems like it should be: 

'FACT_NCM_QFRZ'[Baseline]*MAX(MD_TIME[Reporting Month Number])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@IlikePBI Seems like it should be: 

'FACT_NCM_QFRZ'[Baseline]*MAX(MD_TIME[Reporting Month Number])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Perfect, it's working. Thank you so much!

 

However I don't understand yet how the MAX has resolved it. If you can please clarify?

 

Thank you again!

@IlikePBI So, the MAX simply gets the maximum value of the column in context. So, each row in your table visual supplys a filter context for the Reporting Month Number. In the first row of the table visual the context is 1, second row 2, etc. So you could have also used MIN intead of MAX and if it is truly a numeric value you could technically use any of the basic aggregators, SUM, AVERAGE, etc. because the context of the row in the visual is filtering the column to a single value.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Great! Thank you so much!

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.