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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Hussein_charif
Helper III
Helper III

filter on 1 level of a matrix

i have a matrix with the following rows :
item,year,month,day.

i have a measure called difference % that gets me the difference % on item level and on year, month and day. the itemNo difference is calculated in a different way, here is the full dax code:

Difference % =
IF(
    COUNTROWS(VALUES(valueEntry[itemNo])) = 1 &&
    NOT(
        ISFILTERED(valueEntry[valuationDate]) ||
        ISFILTERED(valueEntry[year]) ||
        ISFILTERED(valueEntry[month]) ||
        ISFILTERED(valueEntry[day])
    ),
   
    VAR CurrentItemNo = MAX(valueEntry[itemNo])
 
    VAR MinDate =
        CALCULATE(
            MIN(valueEntry[valuationDate]),
            FILTER(
                ALL(valueEntry),
                valueEntry[itemNo] = CurrentItemNo
            )
        )
 
    VAR MaxDate =
        CALCULATE(
            MAX(valueEntry[valuationDate]),
            FILTER(
                ALL(valueEntry),
                valueEntry[itemNo] = CurrentItemNo
            )
        )
 
    VAR MinDateValue =
        CALCULATE(
            DIVIDE(
                SUM(valueEntry[Cost]),
                SUM(valueEntry[itemLedgerEntryQuantity]),
                0
            ),
            valueEntry[valuationDate] = MinDate
        )
 
    VAR MaxDateValue =
        CALCULATE(
            DIVIDE(
                SUM(valueEntry[Cost]),
                SUM(valueEntry[itemLedgerEntryQuantity]),
                0
            ),
            valueEntry[valuationDate] = MaxDate
        )
 
    VAR Difference = MaxDateValue - MinDateValue

    VAR itemdiff =
            DIVIDE(
            Difference,
            MinDateValue,
            0
        )
 
    RETURN
    itemdiff,
 
    DIVIDE(
        [Difference],
        [Average],
        0
    )
)
 
i want to filter another matrix in a bookmark to show only where the item difference % is >2.5%. how can i do it?Screenshot 2024-12-04 163826.png
1 ACCEPTED SOLUTION
v-linyulu-msft
Community Support
Community Support

Hi, @Hussein_charif 

As I am not entirely clear on your data, I have created the following example:

vlinyulumsft_0-1733381707468.png

1.Firstly, you can use the following calculation columns:

Column =
IF (
    CALCULATE (
        'valueEntry'[Difference %],
        ALLEXCEPT ( 'valueEntry', 'valueEntry'[itemNo] )
    ) >= 0.25,
    1,
    0
)

2.Secondly, apply this calculated column to the visualisation object.  

vlinyulumsft_1-1733381736306.png

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_2-1733381736308.png

The final result may still need adjustments based on your data.Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

We recommend uploading it to GitHub and sharing the link with us.When uploading a file, please be careful to delete sensitive information.

 

Please find the attached pbix relevant to the case.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
v-linyulu-msft
Community Support
Community Support

Hi, @Hussein_charif 

As I am not entirely clear on your data, I have created the following example:

vlinyulumsft_0-1733381707468.png

1.Firstly, you can use the following calculation columns:

Column =
IF (
    CALCULATE (
        'valueEntry'[Difference %],
        ALLEXCEPT ( 'valueEntry', 'valueEntry'[itemNo] )
    ) >= 0.25,
    1,
    0
)

2.Secondly, apply this calculated column to the visualisation object.  

vlinyulumsft_1-1733381736306.png

3.Here's my final result, which I hope meets your requirements.

vlinyulumsft_2-1733381736308.png

The final result may still need adjustments based on your data.Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

We recommend uploading it to GitHub and sharing the link with us.When uploading a file, please be careful to delete sensitive information.

 

Please find the attached pbix relevant to the case.

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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