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
Anonymous
Not applicable

Create measure considering columns and rows of a matrix

Hi,

I created a measure to calculate the cumulative actuals based on the query new business basic. What is the suggested approach to make this measure adaptive to be used in a Matrix using different fields of the NewBusinessBasic query as columns and rows, e.g. products, vendors?

 

AnnualPremiumCum = CALCULATE(SUM('NewBusinessBasic'[AnnualPremium]); FILTER(ALLSELECTED('NewBusinessBasic');'NewBusinessBasic'[Policy_StartDate] <= MAX('NewBusinessBasic'[Policy_StartDate])))

 

 

 

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,
What error did you meet when you drag the fields into the matrix? Was it like this?
f8.PNG

 

If yes , you can change the data type:

f9.PNG

 

Best regards,
Lionel Chen

 

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

Anonymous
Not applicable

Hi Lionel, thanks for the help, no specific error but the number simply don't adjust to the columns and rows of the matrix. Which is not suprising, because the DAX statement needs adjustetment, psydo code:

 

AnnualPremiumCum = CALCULATE(SUM('NewBusinessBasic'[AnnualPremium]); FILTER(ALLSELECTED('NewBusinessBasic');'NewBusinessBasic'[Policy_StartDate] <= MAX('NewBusinessBasic'[Policy_StartDate]; CONSIDER Matrix Rows, CONSIDE Matrix columns)))

Hi @Anonymous ,
Maybe you can try this DAX:

In general, when we calculate the cumulative we need to use the 'EARLIER()' function.

 

 

AnnualPremiumCum = 
CALCULATE(
  SUM('NewBusinessBasic'[AnnualPremium]),
  FILTER(
    ALLSELECTED('NewBusinessBasic'),
    'NewBusinessBasic'[Policy_StartDate] <= EARLIER('NewBusinessBasic'[Policy_StartDate])
  )
)

 


or

 

AnnualPremiumCum = 
CALCULATE(
  SUM('NewBusinessBasic'[AnnualPremium]),
  FILTER(
    'NewBusinessBasic',
    'NewBusinessBasic'[Policy_StartDate] <= EARLIER('NewBusinessBasic'[Policy_StartDate])
  )
)

 

(I wrote it by hand. There might be some grammar mistakes)


Regards,
Lionel 

 

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.