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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Manudata
Frequent Visitor

Create a dimnesion based on a field to categorize other measures

Hello, I am trying to make a visualization and I am unable to find the way

 

I explain myself with a simple model, where I have a fact table with records of picking harvest jobs, a dimension table with the fruit plantation where the collection was donde and another table with the owners of this plantations.

model.png

 

The field I want to create is a size range field, so that I can make a visualization that tells me for a certain size range, when there are fields, how much has been collected in them.

At the same time, this range field should function as a filter, so that if I click on the range 100-200, in a table where I have the list of plantations, it will tell me which ones they are.

An additional complication is that if I filter for example idfruits, the measurements inside must be dynamic (example with no. owners:  After filtering certain idfruits, one owner that I am counting in a range of 1000-2000 when removing certain plantations, I must count him in 100-500 range)

vizz.png

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

One of ways is having the range_surface table like below.

 

Jihwan_Kim_2-1706507556105.png

 

Jihwan_Kim_1-1706507209410.png

 

Jihwan_Kim_3-1706507968616.png

 

Quantity total: = 
VAR _rangetablecondition =
    FILTER (
        d_plantation,
        CALCULATE ( SUM ( d_plantation[surface_size] ) ) >= MIN ( d_rangesurface[min] )
            && CALCULATE ( SUM ( d_plantation[surface_size] ) ) <= MAX ( d_rangesurface[max] )
    )
RETURN
    CALCULATE ( SUM ( f_harvest[quantity] ), _rangetablecondition )

 

# plantation: = 
VAR _rangetablecondition =
    FILTER (
        d_plantation,
        CALCULATE ( SUM ( d_plantation[surface_size] ) ) >= MIN ( d_rangesurface[min] )
            && CALCULATE ( SUM ( d_plantation[surface_size] ) ) <= MAX ( d_rangesurface[max] )
    )
RETURN
    CALCULATE ( COUNTROWS(DISTINCT(d_plantation[idplantation])), _rangetablecondition )

 

# manager: = 
VAR _rangetablecondition =
    FILTER (
        d_plantation,
        CALCULATE ( SUM ( d_plantation[surface_size] ) ) >= MIN ( d_rangesurface[min] )
            && CALCULATE ( SUM ( d_plantation[surface_size] ) ) <= MAX ( d_rangesurface[max] )
    )
RETURN
    CALCULATE ( COUNTROWS(DISTINCT(d_plantation[idmanager]) ), _rangetablecondition )

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.


Go to My LinkedIn Page


talespin
Solution Sage
Solution Sage

Hi @Manudata ,

 

I think this is the solution you need. Create groups in Power BI or Power Query, there are multiple solutions shown here.

Create Buckets or Groups with Power Query in Power BI - YouTube

v-jialongy-msft
Community Support
Community Support

Hi @Manudata 

 

Can you provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.

 

 

Best Regards,

Jayleny

 

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors