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

Consumption dax

 
1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @jeanbinhozouza 

Thanks for reaching out to us.

>>The problem arises when I change the date to get last week's consumption of parts, in this case even having previous consumption, the horimetropenultimatroca column does not show the values ​​because it ends up filtering the date.

The usual practice is to create a separate calendar table, then use the date in the calendar for the slicer, and then get the date range in the slicer to calculate the horimetropenultimatroca.

for example, create the 2 measures below to get the date range in slicer

selectedRange_start= minx(allselected('calendar'),[date])

selectedRange_end= maxx(allselected('calendar'),[date])

then, create a measure to calculate horimetropenultimatroca, for example, you can time offset the obtained date range, use edate() or eomonth()

FYI: 

EDATE function (DAX) - DAX | Microsoft Docs

EOMONTH function (DAX) - DAX | Microsoft Docs

measure = 
var _newstart= EDATE([selectedRange_start],-1)
var _newend= EDATE([selectedRange_end],-1)
return sumx(filter(all('fact table'),'fact table'[date]>=_newstart && 'fact table'[date]<=_newend), [sale])

vxiaotang_0-1657513025331.png

vxiaotang_1-1657513034642.png

If you need more help, please let me know. 

 

Best Regards,

Community Support Team _Tang

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

View solution in original post

1 REPLY 1
v-xiaotang
Community Support
Community Support

Hi @jeanbinhozouza 

Thanks for reaching out to us.

>>The problem arises when I change the date to get last week's consumption of parts, in this case even having previous consumption, the horimetropenultimatroca column does not show the values ​​because it ends up filtering the date.

The usual practice is to create a separate calendar table, then use the date in the calendar for the slicer, and then get the date range in the slicer to calculate the horimetropenultimatroca.

for example, create the 2 measures below to get the date range in slicer

selectedRange_start= minx(allselected('calendar'),[date])

selectedRange_end= maxx(allselected('calendar'),[date])

then, create a measure to calculate horimetropenultimatroca, for example, you can time offset the obtained date range, use edate() or eomonth()

FYI: 

EDATE function (DAX) - DAX | Microsoft Docs

EOMONTH function (DAX) - DAX | Microsoft Docs

measure = 
var _newstart= EDATE([selectedRange_start],-1)
var _newend= EDATE([selectedRange_end],-1)
return sumx(filter(all('fact table'),'fact table'[date]>=_newstart && 'fact table'[date]<=_newend), [sale])

vxiaotang_0-1657513025331.png

vxiaotang_1-1657513034642.png

If you need more help, please let me know. 

 

Best Regards,

Community Support Team _Tang

If this post helps, 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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.