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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
isaki
Regular Visitor

How to create a measure

Hello,
Sorry this may be simple but I am new to Power BI.
I need to count the number of sales of the target items in the sales report like below. (colored cells)
The target Items is basically A, but B and C are added from depending on the year.
In the table below, I would like to get the number ”10” to be returned. How should I create a measure?

<Target Items>
04/01/2020 - 03/31/2021 -> "A"
04/01/2021 - 03/31/2022 -> "A","B"
04/01/2022 - 03/31/2023 -> "A","B","C"
04/01/2023 -> "A"
isaki_0-1688303351975.png
Any help would be greatly appreciated.

2 REPLIES 2
isaki
Regular Visitor

Hi Jihwan_Kim,
Thank you for your reply!
Is it possible to obtain the results without having to create a "target" table?
In another similar report that I am currently working on, there are 7 types of items (A, B, C, D, E, F, G), and only "A" needs to be calculated after FY23. It would be even more helpful if I didn't have to add "A" to the target table every year.
FY20 = "A"
FY21 = "A", "B"
FY22 = "A", "C"
FY23,24,25..... = "A"

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your datamodel.

 

Jihwan_Kim_1-1688307196476.png

 

 

Jihwan_Kim_0-1688307074983.png

 

 

 

Target measure: = 
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE (
            'Order',
            'Calendar'[Fiscal Year],
            'Calendar'[Year-Month],
            'Calendar'[Year-Month Sort],
            'Item'[Order Item],
            'Order'[Order ID]
        ),
        "@Target",
            VAR _fy = 'Calendar'[Fiscal Year]
            RETURN
                IF (
                    CALCULATE ( MAX ( 'Item'[Order Item] ) )
                        IN SUMMARIZE ( FILTER ( Target, Target[Fiscal Year] = _fy ), Target[Target] ),
                    1,
                    0
                )
    )
RETURN
    SUMX ( _t, [@Target] )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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