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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Anonymous
Not applicable

Need help to write a measure

Hi,

 

Please refer the below link to download the sample report pbix

https://www.dropbox.com/s/2io37811qat95b8/sample%20report.pbix?dl=0

 

Current Behavior:

If i select any row in product_data table... table 2 table is displaying with the respective data of that selected quote and version.

 

followed below steps to achieve the requirement:

 

Created a copy from product table to achieve the requirement.

 

Steps:

 

1. Create new table based on product table and use new table to build visual.

Table formula:

 

Table = product_data

 

2.  measure to get selected value from new table, then compare table 2 row contents with above value to return tag.

 

Measure:

 

Tag =
IF (
MAX ( addon_data[version] ) IN ALLSELECTED ( 'Table'[version] )
&& MAX ( addon_data[quoteNo] ) IN ALLSELECTED ( 'Table'[quoteNo] ),
1,
0
)

 

3. Drag tag measure to table 2 visual level filter.

 

i want to add below condition to the measure:

 

If i select any row in product_data table... table 2 table is displaying with the respective data of that selected quote and version. Along with that, I also need condition so that the proposalId column value in table 2 to be replaced with proposalNewId column value (i.e. 12 ). fyi... proposalNewId column is in addon_data table.

4 REPLIES 4
Seward12533
Solution Sage
Solution Sage

Can you please clarify what your after? If your trying to actually modify the contents of a table based on a slicer condition this is not possible as any calculated  columns are calculated when the worksheet is opened or data is refreshed but BEFORE any slicer selections are made. 

 

IF you just want to to display the value of your proposal new ID (I.e. 12) to be displayed in your visual then just drag it in and set the the calculation to any aggregate measure like MAX, MIN etc and rename.  If you want to conditionally display this alternate  value you would need to write a measure.

 

Can you mock up what you want the desired output to be?  

Anonymous
Not applicable

Thank you for reply. Appreciate it. 

 

 If  User selects the selected record in the product_data table then the expected behavior should be like below

Attached  mockup is the desired output.   

 

please let me know if  further information is needed. 

 

 

Expected Behaviour.png

 

 If  User unselects the selected record in the product_data table then the expected behavior should be like below,  i.e.  proposalId column value in table 2   should be replaced with  1 . 

 

 

unselect record - expected behavior.png

Hi @Anonymous,

 

We can create a measure like this to meet your requirement.

 

Measure 2 = IF(ISFILTERED(product_data[category]),MAX(addon_data[proposalId]),MAX(addon_data[proposalNewId]))

Capture.PNG

 

For more details, please check the pbix as attached.

 

https://www.dropbox.com/s/t2t42p4sb7zz1ep/sample%20report%20%281%29.pbix?dl=0

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi,  Need some help. Please correct my mistake in the measures .  

 

I have tried to incorporate the same measure logic in  the power bi report  i am working  on but seems to be the measures are not working.  The issue is   the Filter value always displays "SinglePartWarrantyRate" column value and  switch condition  is not working.  I have used 2 measures  but nothing is working.  Please correct my mistake .  

 

Measures I used:

 

Filter = IF(
ISFILTERED('VehicleTrend'[LoDate]),SWITCH(CALCULATE(SUM(VehicleTopIssue[C/100])),MAX('VehicleTopIssue'[C/100]),MAX(VehicleTopIssue[SinglePartWarrantyRate])),CALCULATE(SUM('VehicleTopIssue'[C/100]))
)

 

 or

Filter =
IF(
ISFILTERED(VehicleTrend[LoDate]),MAX(VehicleTopIssue[C/100]),MAX(VehicleTopIssue[SinglePartWarrantyRate])
)

 

 

I have 2 columns  "C/100"   and    "SinglePartWarrantyRate" in table. these columns are decimal(11,10) datatypes. refer the screenshot.

 

table screenshot.png

 

Requirement:

 

1) if user selects the LoDate column (i.e. August 2017)  in a Line and stacked column chart ( refer  the screenshot  ) the filter measure should display the "SinglePartWarrantyRate" column value.

 

filter value 1.png

 

2) If  User unselects theLoDate column (i.e. August 2017)  in a Line and stacked column chart then the expected behavior should be   Filter measure value  should display the "C/100" column value.  By default   Filter measure value  should display the "C/100" column value. 

 

filter value 2.png

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.