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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Measure to form the sum with variables

Dear Power BI community,

 

I have the following data set. To make my problem easier to understand, I have chosen this representation.

 

 120192201932019420195201962019720198201992019102019112019122019
VJ111231(1)11000
R01300122100000000
R0205001321(4)000000
R030080020(6)(10)010000
R0400070030(3)211000
R05000080015421110
R06000001.0002520010
R07000000700200(3)00
R08000000060045(1)30
R09000000009003010
R100000000009005012
R1100000000001.00040
R12000000000001.100
Uother000000000000

 

I am looking for a measure with which I can add up the lines above, up to the line before the current month.

 

E.g.:

If I filter "42019" I want to get "25" (2 + 1 + 2 + 20 = the values from 42019 VJ+R01+R02+R03).

If I filter "52019" then "28" (3 + 0 + 1-6 + 30 = the values of 52019 VJ+R01+R02+R03+R05) and so on.

 

This should also work if I choose several months at once.

E.g. "12019 to 32019" and then get the value "30" (1 + 1 + 1 + 12 + 2 + 13)

 

Do you have an idea how I can set up such a measure?

 

Thanks in advance for your help

 

Kind regards,

Jinu

 

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

Hi,  @Anonymous 

 

It’s my pleasure to answer for you.

According to your description,I think you can create two column and a measure to calculate the desired result.

Like this:

 

index2 =
RANKX ( ALL ( 'Table' ), 'Table'[R],, ASC, DENSE )
month = LEFT('Table'[Attribute],SEARCH("2019",[Attribute])-1)
//Need to change the format to number
total = SUMX(FILTER('Table',[index2]<[month]||[index2]=14),[Value])

 

3.png

Here is my sample .pbix file.Hope it helps.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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-janeyg-msft
Community Support
Community Support

Hi,  @Anonymous 

 

It’s my pleasure to answer for you.

According to your description,I think you can create two column and a measure to calculate the desired result.

Like this:

 

index2 =
RANKX ( ALL ( 'Table' ), 'Table'[R],, ASC, DENSE )
month = LEFT('Table'[Attribute],SEARCH("2019",[Attribute])-1)
//Need to change the format to number
total = SUMX(FILTER('Table',[index2]<[month]||[index2]=14),[Value])

 

3.png

Here is my sample .pbix file.Hope it helps.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

Anonymous
Not applicable

Hi,

 

no that is not the source data format.

The shown one is to explain the problem.

I already unpivot it, but that doesn't help me too

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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