Forum Discussion

Sahil5791's avatar
Sahil5791
New Member
1 year ago
Solved

Assigning a group from.

I have 2 two tables in powerBI. They are not connected yet.  1) Sales Table 2) Pricing Sheet I also have calendar table connected with Sales table with one to many relationship. I have a require...
  • burakkaragoz's avatar
    1 year ago

    Hi Sahil5791 ,

     

    You're almost there. Since your Assign table isn't directly related to the Calendar or Sales table, using a measure like the one below is a good approach. Here's a slightly refined version that might help with clarity and performance:

    Sales by Assigned Group = 
    VAR selectedDate = SELECTEDVALUE('Calendar'[Date])
    RETURN
    CALCULATE(
        SUM('Sales'[SalesAmount]),
        FILTER(
            'Assign',
            'Assign'[StartDate] <= selectedDate &&
            'Assign'[EndDate] >= selectedDate
        )
    )

    Make sure your visual includes the 'Group' column from the Assign table. This way, the measure will evaluate the sales amount for each group where the selected date falls between the start and end dates.

    Also, if your Sales table has a group reference, you might need to adjust the logic to join that with Assign, or use TREATAS to simulate a relationship.

    Let me know if you need help wiring the tables together or optimizing the model.

    If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
    translation and formatting supported by AI