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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Harish85
Helper II
Helper II

Required Dax formula for below table.

Harish85_0-1756213634233.png

HI All,

 

In the table 74k above columns ,if customer id is same(c240008470) for VTWEG 11 and 13 then we should show only 11 values. Please help with the formula

 

 

1 ACCEPTED SOLUTION
v-ssriganesh
Community Support
Community Support

Hello @Harish85,
I have reproduced your scenario in Power BI Desktop using the sample data you provided. I implemented a DAX formula to filter the table as per your requirement showing only VTWEG 11 for CUSTOMER_IDs with multiple VTWEG values (e.g: 11, 13, 15), while keeping all rows for CUSTOMER_IDs with a single VTWEG value.

I got the expected output based on your description:

vssriganesh_0-1756893563667.png


For your reference, I have attached a .pbix file containing the solution, including the sample data and the implemented DAX formula. You can download it, open it in Power BI Desktop, and explore the FilteredSalesData table to see the results.

 

Best regards,
Ganesh Singamshetty

View solution in original post

13 REPLIES 13
v-ssriganesh
Community Support
Community Support

Hello @Harish85,
I have reproduced your scenario in Power BI Desktop using the sample data you provided. I implemented a DAX formula to filter the table as per your requirement showing only VTWEG 11 for CUSTOMER_IDs with multiple VTWEG values (e.g: 11, 13, 15), while keeping all rows for CUSTOMER_IDs with a single VTWEG value.

I got the expected output based on your description:

vssriganesh_0-1756893563667.png


For your reference, I have attached a .pbix file containing the solution, including the sample data and the implemented DAX formula. You can download it, open it in Power BI Desktop, and explore the FilteredSalesData table to see the results.

 

Best regards,
Ganesh Singamshetty

Hello @Harish85,

Hope everything’s going great with you. Just checking in has the issue been resolved or are you still running into problems? Sharing an update can really help others facing the same thing.

Thank you.

Aburar_123
Solution Supplier
Solution Supplier

Hi @Harish85 ,

Could you mark my post as a solution if it solves your problem. so that other people also can refer it.

 

Thanks.

Hi Aburar, thank you very much for  your time. in the below screenshot I marked yellow for customer ID which is repeating,for that VTWEG column has 11,13 and 15 values, but we should show only 11 columns ,same should be repeated for other customer id's also.

Harish85_0-1756875452358.png

 

v-ssriganesh
Community Support
Community Support

Hello @Harish85,

We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

Thank you.

v-ssriganesh
Community Support
Community Support

Hi @Harish85,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @ryan_mayu , @Shahid12523 & @DataNinja777 for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

 

Thank you for being part of the Microsoft Fabric Community.

Shahid12523
Community Champion
Community Champion

DAX Calculated Column

 

ShowRow = IF( CALCULATE(COUNTROWS('YourTable'), 'YourTable'[CUSTOMER_ID] = EARLIER('YourTable'[CUSTOMER_ID]), 'YourTable'[VTWEG] = 11) > 0 && CALCULATE(COUNTROWS('YourTable'), 'YourTable'[CUSTOMER_ID] = EARLIER('YourTable'[CUSTOMER_ID]), 'YourTable'[VTWEG] = 13) > 0, IF('YourTable'[VTWEG] = 11, 1, 0), 1 )

 

 

Use ShowRow = 1 to filter your table.
Keeps only VTWEG = 11 when both 11 and 13 exist for same CUSTOMER_ID.

Shahed Shaikh
Shahid12523
Community Champion
Community Champion

Measure (For Visual-Level Filtering)

ShowRowMeasure =
VAR CurrentCustomer = SELECTEDVALUE('YourTable'[CUSTOMER_ID])
VAR CurrentVTWEG = SELECTEDVALUE('YourTable'[VTWEG])
VAR HasVTWEG11 =
CALCULATE(
COUNTROWS('YourTable'),
ALL('YourTable'),
'YourTable'[CUSTOMER_ID] = CurrentCustomer,
'YourTable'[VTWEG] = 11
)
VAR HasVTWEG13 =
CALCULATE(
COUNTROWS('YourTable'),
ALL('YourTable'),
'YourTable'[CUSTOMER_ID] = CurrentCustomer,
'YourTable'[VTWEG] = 13
)
RETURN
IF(
HasVTWEG11 > 0 && HasVTWEG13 > 0,
IF(CurrentVTWEG = 11, 1, 0),
1
)

Use this measure as a visual-level filter:
Filter → ShowRowMeasure = 1

 

 



Shahed Shaikh
Shahid12523
Community Champion
Community Champion

Calculated Column (Flagging Rows to Keep)

ShowRow =
VAR CurrentCustomer = 'YourTable'[CUSTOMER_ID]
VAR HasVTWEG11 =
CALCULATE(
COUNTROWS('YourTable'),
'YourTable'[CUSTOMER_ID] = CurrentCustomer,
'YourTable'[VTWEG] = 11
)
VAR HasVTWEG13 =
CALCULATE(
COUNTROWS('YourTable'),
'YourTable'[CUSTOMER_ID] = CurrentCustomer,
'YourTable'[VTWEG] = 13
)
RETURN
IF(
HasVTWEG11 > 0 && HasVTWEG13 > 0,
IF('YourTable'[VTWEG] = 11, 1, 0),
1
)

Shahed Shaikh
DataNinja777
Super User
Super User

Hi @Harish85 ,

 

You can solve this by creating a new calculated table using a DAX formula. This formula will produce a copy of your table that excludes the specific rows based on your condition. Below is the DAX code to accomplish this. Please remember to replace 'YourTable' with the actual name of your data table.

Filtered Sales = 
VAR CustomersWithBothChannels =
    INTERSECT (
        CALCULATETABLE ( VALUES ( 'YourTable'[CUSTOMER_ID] ), 'YourTable'[VTWEG] = 11 ),
        CALCULATETABLE ( VALUES ( 'YourTable'[CUSTOMER_ID] ), 'YourTable'[VTWEG] = 13 )
    )
RETURN
    FILTER (
        'YourTable',
        NOT ( 'YourTable'[CUSTOMER_ID] IN CustomersWithBothChannels && 'YourTable'[VTWEG] = 13 )
    )

To use this formula, navigate to the Data view in Power BI Desktop. In the ribbon, select New Table. You can then paste the DAX formula into the formula bar that appears and press Enter. This action will generate the new filtered table, which will then be available for use in your reports and visuals.

 

The formula works in two main parts. First, it identifies and creates a temporary list of all CUSTOMER_IDs that have records for both VTWEG = 11 and VTWEG = 13. This list is stored in a variable called CustomersWithBothChannels. Next, the FILTER function iterates through your original table, keeping all rows except for those where the CUSTOMER_ID is in that special list and the VTWEG value is 13. This ensures that for customers with both values, only the row with VTWEG = 11 is kept, while all other records for all other customers remain untouched.

 

Best regards,

Sorry your formula is working there is a small change in the requirement, below is the example ,in below table there are three rows, but we should shown only VTWEG 11 VALUES.

ZZ_KUNAGVKORGVTWEGZZ_PARTNER_TYPECUSTOMER_ID
C240011427240111REC240011427
C240011427240113REC240011427
C240011427240115REC240011427

Hi @Harish85 ,

Please try with the below calculated column that helps to choose the minimum VTWEG value.

Required Value Flag =
var min_value = CALCULATE(MIN('Table'[VTWEG]),FILTER(ALL('Table'),'Table'[ZZ_KUNAG]=EARLIER('Table'[ZZ_KUNAG])))
return if('Table'[VTWEG]=min_value,1)

Aburar_123_0-1756696195985.png

 

Thanks.

@Harish85 

you can create a column

Column = if('Table'[CUSTOMER_ID]="C240011427" && 'Table'[VTWEG]=11, 1)
 
and filter 1 in the table visual
 
11.png
 
or create a measure
 
Measure = if(max('Table'[CUSTOMER_ID])="C240011427" && MAX('Table'[VTWEG])=11,1)
 
and set the measure to 1
 
12.png




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.