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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
likhithar
Helper III
Helper III

DAX in getting Maximum Rate by Month

Hello All,

I have Cost , Sales fact tables . Town,State and DateTable are Dimension Tables. My Total Value is Sales+Cost.

I have another table which is Rates Table where rates will be there on  month basis. 

I tried two ways in deriving DAX

Total= SUM(Sales[Sales)+SUM(Cost[Cost])

Total YTD = CALCULATE([Total],DATESYTD(DateTable[Date]))

Total with Rate = SUMX(RatesTable,RatesTable[Rate])*[Total YTD]

Rates Table and Sales,Cost Table are related based on TownID+StateID+YYYYMM.The Rates will be at Town,State Level.

If I select 202102 , Total should get multiplied with feb Rate , If I select 202101 , Total should get multiplied with Jan Rate

With the above modeling and DAX , I'm the output as= Total YTD*JanRate+TotalYTD*FebRate.

 

  • I tried another Data Modeling where I give relationship to Rates Table with Dimension Tables itself instead of Fact Table(means RatesTable[TownID]-Town[TownID] ; RatesTable[StateID]-State[StateID] ; RatesTable[YYYYMM]-DateTable[YYYYMM] 
  • With the second Modelling I'm getting correct output by rows but total is showing wrong
  • Total with Rate = SUMX(RatesTable,RatesTable[Rate])*[Total YTD]
  • likhithar_0-1638965260091.png

    There will be a dimension column which is Concatenation of Country+State+Town , against that dimension I will be projecting Total with Rate .

    Help me out on this.How to Sort it out?? TIA
1 REPLY 1
Anonymous
Not applicable

Hi  @likhithar ,

Here are the steps you can follow:

1. Create calculated table.

Table = SUMMARIZE('Rates Table','Rates Table'[YYYMM],"1",MAX('Rates Table'[Rate]))

2. Create measure.

Flag =
var _table=SUMMARIZE('Table','Table'[YYYMM],"value",SUM('Table'[1])*[TotalYTD])
return
SUMX(_table,[value])

3. Result:

vyangliumsft_0-1639374740421.png

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.