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
skumar0105
Helper II
Helper II

How to create PBI report using range columns with an user input field

Hi,

I want to create a Power BI report of a dataset having range columns. also i need a functionality to give user input field.

once the user has entered the input in field, the value should match with the ranges mentioned in 04 columns.

 

if the input of all 04 columns is within the range, then its corresponding value mentioned in 05th column should get reflected.

 

refer below table:

 

Col1Col2Col3Col4Col5
1.5-4.80.2-3.010-28180-26010.6
0.2-3.91.0-4.212-38200-4009.7
1.3-5.20.8-3.908-26140-29012.5
0.8-4.21.9-5.806-20160-3308.8
1.0-5.80.8-5.215-45110-5507.6

 

e.g. (i am using example of row 3)

if the user input value is 4.8(Col1),3.6(Col2),22(Col3) and 220(Col4) then the corresponding value 12.5 should be reflected.

 

so far i have created min & max columns from each column and applied the if condition, i have created user input field as well using the What if parameter, but when i enter the values in only single field then the col5 value is getting reflected but entering the values from other columns does not make any changes in col5 value.

all i am getting is a mess!

Any suggestions or approach would be highly appreciable.

 

Regards

Satish 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @skumar0105 

 

Your example input 4.8(Col1),3.6(Col2),22(Col3) and 220(Col4) meets both row 3 and row 5 in the table. For this scenario that an input may meet multiple rows, which Col5 will you hope to display? Or perhaps you want to display all of them?

 

Suppose you want to display all the Col5 values that meet the input, you can try my solution as below. 

 

First I transform the original table into the following format with Power Query Editor. 

vjingzhang_0-1677216632135.png

Then create the following measure to get the reflected col5 values and concatenate them. If the input only meets one row's range, it will display the single reflected col5 value. 

Measure = 
var _col1 = [Col1_input Value]
var _col2 = [Col2_input Value]
var _col3 = [Col3_input Value]
var _col4 = [Col4_input Value]
var _col1Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col1" && 'Table'[MinValue]<= _col1 && 'Table'[MaxValue] >= _col1)
var _col2Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col2" && 'Table'[MinValue]<= _col2 && 'Table'[MaxValue] >= _col2)
var _col3Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col3" && 'Table'[MinValue]<= _col3 && 'Table'[MaxValue] >= _col3)
var _col4Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col4" && 'Table'[MinValue]<= _col4 && 'Table'[MaxValue] >= _col4)
return
CONCATENATEX(INTERSECT(INTERSECT(INTERSECT(_col1Value,_col2Value),_col3Value),_col4Value), 'Table'[Col5], "; ")

vjingzhang_1-1677216932352.png

The sample pbix has been attached at bottom. You can download it to see details. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @skumar0105 

 

Your example input 4.8(Col1),3.6(Col2),22(Col3) and 220(Col4) meets both row 3 and row 5 in the table. For this scenario that an input may meet multiple rows, which Col5 will you hope to display? Or perhaps you want to display all of them?

 

Suppose you want to display all the Col5 values that meet the input, you can try my solution as below. 

 

First I transform the original table into the following format with Power Query Editor. 

vjingzhang_0-1677216632135.png

Then create the following measure to get the reflected col5 values and concatenate them. If the input only meets one row's range, it will display the single reflected col5 value. 

Measure = 
var _col1 = [Col1_input Value]
var _col2 = [Col2_input Value]
var _col3 = [Col3_input Value]
var _col4 = [Col4_input Value]
var _col1Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col1" && 'Table'[MinValue]<= _col1 && 'Table'[MaxValue] >= _col1)
var _col2Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col2" && 'Table'[MinValue]<= _col2 && 'Table'[MaxValue] >= _col2)
var _col3Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col3" && 'Table'[MinValue]<= _col3 && 'Table'[MaxValue] >= _col3)
var _col4Value = CALCULATETABLE(VALUES('Table'[Col5]), 'Table'[Column]="Col4" && 'Table'[MinValue]<= _col4 && 'Table'[MaxValue] >= _col4)
return
CONCATENATEX(INTERSECT(INTERSECT(INTERSECT(_col1Value,_col2Value),_col3Value),_col4Value), 'Table'[Col5], "; ")

vjingzhang_1-1677216932352.png

The sample pbix has been attached at bottom. You can download it to see details. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hi @v-jingzhang 

Thanks for support.

It worked for me.

Few more queries on this:

1. What should i change if in case i want to show only the max or min value of Measure.

2. is there any functionalty in Power BI where i can give a blank user input column and user can add the actual value which is set by him after getting the value from Measure column and the input value should get recorded alongwith current Datetime.

Basically i want to do a Set Vs. Actual Comparison along with Date & time of act.

Hi @skumar0105 

 

1. For the first question, you can modify the last expression to return max/min value by using MAXX/MINX. 

.............
return
MAXX(INTERSECT(INTERSECT(INTERSECT(_col1Value,_col2Value),_col3Value),_col4Value), 'Table'[Col5])

 

2. For the second question, do you want to record users' input into the data model along with every input action's datetime? If so, I'm afraid this is not supported. Power BI allows you to query data into the report but doesn't allow you to insert new data back into the same data source. 

 

Best Regards,
Community Support Team _ Jing

Hi @v-jingzhang 

Thanks for reply.

Your solutions worked for me.

 

Thanks you so much.

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.

Top Solution Authors
Top Kudoed Authors