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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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