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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Use selectedvalue in a measure

Hello,

 

I am new to PowerBI. I have a dataset, sample of it: 

VersionMonthValue
LE05110
LE05215
LE05318
LE05420
LE05540
LE04150
LE04220
LE04310
LE04430
LE04525

 

I have a slicer with the monthnumber. When selecting the monthnumber, e.g. monthnumber 4, it should 'select' LE04 and do a sum of the values of ALL months. When selecting monthnumber 5, it should select LE05. etc.  I cannot find a solution. I tried to use a help table with columns month & Version but that is not working. Do you have any idea how to solve this?

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

There can be many ways to achieve your result. One of them is below:

 

1. In Query Editor, create a column called "Version Number" which I created using Column from Example option. Let this column store the number at the end of your Version.

Capture.PNG

 

2. Close and apply changes. Change the data type of this column from text to whole number in Power BI Desktop.

 

Capture.PNG

 

3. Create a calculated table which will store the DISTINCT month numbers. This table will be used to for Month Number slicer.

 

AllMonths = DISTINCT(
            Table1[Month]
            )

4. Create following measure which will hold SUM of the VALUE.

Sum Of Value = 
CALCULATE(SUM(Table1[Value]),
    FILTER(Table1,
        Table1[Version Number] = SELECTEDVALUE(AllMonths[Month])))


5. Now make sure the Month Number slicer is using the Month field from calculated table.
6. Use the Sum Of Value measure created in the visual where you intent to show the sum.

 

Thats it. You have achieved what you wanted.
Here is a snapshot:

Capture.PNG

 


Note: Use your table names in the expressions. Table1 must be renamed to your table which contains the actual data.

Prateek Raina

View solution in original post

6 REPLIES 6
prateekraina
Memorable Member
Memorable Member

Hi @Anonymous,

 

So do you mean whatever Month number you choose the corresponding Version number should be chosen and then it sum all the values of month which fall under that version?

 

If I am wrong then kindly share the expected output also in the similar way you have shared the sample data. That would help in providing solution quickly.

 

Prateek Raina

Anonymous
Not applicable

Hello Prateek,

 

You are right. So in my example when I choose monthnumber 4, in a matrix visual it should show the version LE04 with the sum of values ALL months: 50+20+10+30+25= 135.outcome.JPG

 

Hi @Anonymous,

 

There can be many ways to achieve your result. One of them is below:

 

1. In Query Editor, create a column called "Version Number" which I created using Column from Example option. Let this column store the number at the end of your Version.

Capture.PNG

 

2. Close and apply changes. Change the data type of this column from text to whole number in Power BI Desktop.

 

Capture.PNG

 

3. Create a calculated table which will store the DISTINCT month numbers. This table will be used to for Month Number slicer.

 

AllMonths = DISTINCT(
            Table1[Month]
            )

4. Create following measure which will hold SUM of the VALUE.

Sum Of Value = 
CALCULATE(SUM(Table1[Value]),
    FILTER(Table1,
        Table1[Version Number] = SELECTEDVALUE(AllMonths[Month])))


5. Now make sure the Month Number slicer is using the Month field from calculated table.
6. Use the Sum Of Value measure created in the visual where you intent to show the sum.

 

Thats it. You have achieved what you wanted.
Here is a snapshot:

Capture.PNG

 


Note: Use your table names in the expressions. Table1 must be renamed to your table which contains the actual data.

Prateek Raina

Anonymous
Not applicable

Hello Prateek,

 

First of all, thank you very much for your in depth help and the example you have built! What a great support! I tried your steps, and all seem to be good. However, I do not get the end result. Probably some basic / simple setting  I forgot. But I cannot find what. 

 

 Proof5.JPGsum.JPG

Proof2.JPG

 

Anonymous
Not applicable

It is working now! I did put in a relation between the 2 tables but that was not a step you told me. I deleted the connection and now it works! Thank you very very much! Proof6.JPG

Great !!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors