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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
13havya
Frequent Visitor

Aggregating multiple variables in DAX measure

Hi,

 

I am trying to build a measure that contains a couple of variables, and I need the totals row to be the sum of all values in the visual. 

 

The logic behind the metric - 

The business records a "cutoff" dataset on the 9th of every month. The cutoff dataset has a record of files opened in the past month (i.e cutoff recorded on 9 May will contain data for files opened in April).

 

I want to design the measure such that: 

 

 

Cutoff Files = 

IF(

DAY(TODAY) < 9,
RETURN CUTOFF (till 2 months ago) + live data from files opened in last month

)

 

This will ensure that all data till the previous month gets populated, regardless of whetehr the cutoff point has been reached or not. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @13havya ,

Based on my testing, please try the following methods again:

1.Create the simple tables.

vjiewumsft_0-1717744479769.png

2.Create the new measure to calculate.

Cutoff files = 
var last_month = CALCULATE(SUM('Table'[Files]), FILTER('Table', MONTH('Table'[Date]) = MONTH(TODAY()) - 1))
VAR two_months = CALCULATE(SUM('Table'[Files]), FILTER('Table', MONTH('Table'[Date]) < MONTH(TODAY()) - 2))
RETURN
IF(DAY(TODAY()) < 9, last_month + two_months)

3.Drag the measure into the card visual. The result is shown below.

vjiewumsft_1-1717744493346.png

Best Regards,

Wisdom Wu

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @13havya ,

Based on my testing, please try the following methods again:

1.Create the simple tables.

vjiewumsft_0-1717744479769.png

2.Create the new measure to calculate.

Cutoff files = 
var last_month = CALCULATE(SUM('Table'[Files]), FILTER('Table', MONTH('Table'[Date]) = MONTH(TODAY()) - 1))
VAR two_months = CALCULATE(SUM('Table'[Files]), FILTER('Table', MONTH('Table'[Date]) < MONTH(TODAY()) - 2))
RETURN
IF(DAY(TODAY()) < 9, last_month + two_months)

3.Drag the measure into the card visual. The result is shown below.

vjiewumsft_1-1717744493346.png

Best Regards,

Wisdom Wu

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

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.