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

Measure Including Year Filter

Hi,
i have done a Measure to get the Revenue from TOP N Products.
N depends on the selected Value from my TOP-N Table (It's containing just the numbers from 1 to 10).
 In the same Measure, I also calculate how much was the revenue of all Products how were not in the selected Top N.
The Code for this is:

Top N Produktbez Sum DB3 =
VAR TopNSelected =
    SELECTEDVALUE ( 'TOP N-Filter'[TOP N] )
VAR TopNProdbezTable =
    TOPN ( TopNSelectedALLSELECTED ( 'Pseudo Produkbez Table' ), [DB3] )
VAR TopNProdbez =
    CALCULATE ( [DB3], KEEPFILTERS ( TopNProdbezTable ) )
VAR OtherSales =
    CALCULATE ( [DB3], ALLSELECTED ( 'Pseudo Produkbez Table' ) )
        CALCULATE ( [DB3], TopNProdbezTable )
VAR CurrentProd =
    SELECTEDVALUE ( 'Pseudo Produkbez Table'[Produktbezeichnung] )
RETURN
    IF ( CurrentProd <> "Others"TopNProdbezOtherSales )


Now I want to add Year as Filter.
I'm using the Year coming from the Date Hierarchy.
Unfortunately, I can't provide a sample yet.
If a sample is need, I will try to create own.

1 REPLY 1
v-janeyg-msft
Community Support
Community Support

Hi, @Yonah 

 

Yes, A sample is needed. Without data and context it's hard to tell where to put the year. Please share it.

 

Best Regards,
Community Support Team _ Janey

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.