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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RenanPNog
Helper I
Helper I

Create a Custom Calculated Table

Hello guys!

I need help on how to create a specific calculated table.

I have my Fact table, where there is all sales records. 
I'll link in this post a dummy file that represents my fact table.

Here's the sample:

RenanPNog_1-1674876793001.png

For example:

group_name "Cars", product "Volvo", status "Old", starts on 07/12/2022 and ends on 15/08/2023.

group_name "Cars", product "Ferrari", status "Old", starts on 23/11/2022 and ends on 06/05/2023.

To make this example easy, let's assume that min date of group_name "cars", status"old" is 23/11/2022, and max date is 15/08/2023.

Result i need: a calculated table that shows for every product with status context a column that contains values from the min date to max date.... So in the new table, row 1 would be "volvo" - "old" - 23/11/2022 and row X (last row of specific product) would be 15/08/2023.

Basically, ignoring the product date context and bringing only group_name and Status filter. 
I've tried to do some Summarize Functions but didn't work.

https://docs.google.com/spreadsheets/d/1g1ywBueUUNO-cRjJl5gu4huIRD0tNip3KJzVjewBgWE/edit?usp=sharing

1 ACCEPTED SOLUTION

hi @RenanPNog 

something like:

Table =
VAR _table =
SUMMARIZE(
    TableName,
    TableName[products],
    TableName[status]
)
RETURN
ADDCOLUMNS(
    _table
    "MinDate",
  CALCULATE(MIN(TableName[day])),
    "MaxDate",
  CALCULATE(MAX(TableName[day]))
)

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @RenanPNog 

are you expecting:
Table =
SUMMARIZE(
    TableName,
    TableName[products],
    TableName[status],
    TableName[day]
)

Hey there, FreemanZ. 

Not really. Because if I do SUMMARIZE function, it will returns me the respectives days of each product, and I want for each product to shows me the minimum and maximum date of group_name

hi @RenanPNog 

something like:

Table =
VAR _table =
SUMMARIZE(
    TableName,
    TableName[products],
    TableName[status]
)
RETURN
ADDCOLUMNS(
    _table
    "MinDate",
  CALCULATE(MIN(TableName[day])),
    "MaxDate",
  CALCULATE(MAX(TableName[day]))
)

Hello, mate!

Not 100% what i needed, but i think summarize will do it anyways. Thanks in advance!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors