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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Himanshu_1306
Resolver I
Resolver I

Calculated Measure

Hi All,

 

I have a situation where I have a Quarter end data for a particular column "CW_QTR_END" in my report.

So now i want to duplicate that value for all the dates in my report.

 

Below is the dax I've used but it is not giving me the desired result. 
ideally as the dates before 31st should be filled up with the value from the 31st i.e 16.70M

 

Need suggestions !!!

 

Himanshu_1306_0-1698332880469.png

 

DAX USED:

 

Fill_blanks =
var _a =
CALCULATE(MAX(VW_F_PIPELINE_SALES_HIERARCHY[DS]),FILTER(ALL(VW_F_PIPELINE_SALES_HIERARCHY),VW_F_PIPELINE_SALES_HIERARCHY[DS]<=MAX(VW_F_PIPELINE_SALES_HIERARCHY[DS]) && VW_F_PIPELINE_SALES_HIERARCHY[CW_QTR_END]<>BLANK()),VW_F_PIPELINE_SALES_HIERARCHY[FISCAL_QUARTER] = "FY24 Q2")

 var _b =
 CALCULATE(SUM(VW_F_PIPELINE_SALES_HIERARCHY[CW_QTR_END]),FILTER(ALL(VW_F_PIPELINE_SALES_HIERARCHY),VW_F_PIPELINE_SALES_HIERARCHY[DS]>=_a),VW_F_PIPELINE_SALES_HIERARCHY[FISCAL_QUARTER] = "FY24 Q2")

 return
 IF(SUM(VW_F_PIPELINE_SALES_HIERARCHY[CW_QTR_END])=BLANK() && _a<>BLANK(),_b,SUM(VW_F_PIPELINE_SALES_HIERARCHY[CW_QTR_END]))

 

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Himanshu_1306 ,

 

What you need is to fill in the previous date with the value of the largest date. Then you can create the following measure:

Measure = var _max=CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table'))
return CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Date]=_max))

vstephenmsft_0-1698732557765.png

If you also need to make up by group, for example, by month, the value of the largest day of the month should be used to fill in the previous date. You can do the following:

First create a monthyear column.

vstephenmsft_1-1698732729185.png

Then create a measure:

Measure 2 = var _max=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),[MonthYear]=MAX('Table'[MonthYear])))
return CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Date]=_max))

vstephenmsft_2-1698732842579.png

 

 

Best Regards,

Stephen Tao

 

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

3 REPLIES 3
v-stephen-msft
Community Support
Community Support

Hi @Himanshu_1306 ,

 

What you need is to fill in the previous date with the value of the largest date. Then you can create the following measure:

Measure = var _max=CALCULATE(MAX('Table'[Date]),ALLSELECTED('Table'))
return CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Date]=_max))

vstephenmsft_0-1698732557765.png

If you also need to make up by group, for example, by month, the value of the largest day of the month should be used to fill in the previous date. You can do the following:

First create a monthyear column.

vstephenmsft_1-1698732729185.png

Then create a measure:

Measure 2 = var _max=CALCULATE(MAX('Table'[Date]),FILTER(ALLSELECTED('Table'),[MonthYear]=MAX('Table'[MonthYear])))
return CALCULATE(SUM('Table'[Value]),FILTER(ALLSELECTED('Table'),[Date]=_max))

vstephenmsft_2-1698732842579.png

 

 

Best Regards,

Stephen Tao

 

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

 

Thanks for the help.

 

I actually figured about another way to get the desired result. But your way is also working 👍

Himanshu_1306
Resolver I
Resolver I

Somehow I have got the data but its not dynamic. It is showing me the max value i.e 34.34 for all my data points whereas I should show 16.70 here.

 

Any leads to resolve this?

 

Himanshu_1306_0-1698334153650.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.