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
Diego_Vialle
Helper II
Helper II

DAX - between the period of the month

I need to automate this measurement to show the value BETWEEN THE PERIOD OF THE MONTH of each column period:

 

Diego_Vialle_0-1656504019462.pngDiego_Vialle_1-1656504043776.png

ROE = (DIVIDE([Lucro Líquido], [Patrimonio Liquido],0) / 1000)

 

2 REPLIES 2
Anonymous
Not applicable

Hi  @Diego_Vialle ,

I created some data:

vyangliumsft_0-1656936679383.png

Here are the steps you can follow:

1. Use Enter data to create a table.

vyangliumsft_1-1656936679384.png

2. Create calculated column.

month =
FORMAT('Table'[Date],"mmm")&"/"&YEAR('Table'[Date])

3. Create measure.

Measure =
var _1=
CALCULATE(SUM('Table'[Patrimonio Liquido]),FILTER(ALL('Table'),
'Table'[month]=MAX('Table'[month])))
var _2=
CALCULATE(SUM('Table'[Lucro Líquido]),FILTER(ALL('Table'),
'Table'[month]=MAX('Table'[month])))
return
DIVIDE(_1,_2)
Measure 2 =
var _1=
CALCULATE(SUM('Table'[Patrimonio Liquido]),FILTER(ALL('Table'),
'Table'[month]=MAX('Table'[month])))
var _2=
CALCULATE(SUM('Table'[Amount1]),FILTER(ALL('Table'),
'Table'[month]=MAX('Table'[month])))
return
DIVIDE(_1,_2)
Measure 3 =
SWITCH(
    TRUE(),
    MAX('Table2'[Group])="Margem Liquida",[Measure],
    MAX('Table2'[Group])="ROE",[Measure 2])

4. Result:

vyangliumsft_2-1656936679389.png

If you need pbix, please click here.

 

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

amitchandak
Super User
Super User

@Diego_Vialle , Not very clear. If you want to save on this month, last month etc. You can have a column

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.