Reply
AllanBerces
Post Prodigy
Post Prodigy
Partially syndicated - Outbound

Column to Measure

Hi Good day,

I can anyone pls how to change the calculated column to measure, The highligthed column how to create in measure.

 

AllanBerces_0-1707365891375.png

Thank you

Allan

1 ACCEPTED SOLUTION

Syndicated - Outbound

Thank you for the help i got the solution by creating Dummy table.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Syndicated - Outbound

Hi,

I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1707368074659.png

 

Jihwan_Kim_1-1707368644133.png

 

 

WINDOW function (DAX) - DAX | Microsoft Learn

 

Rev sum: = 
SUM( Sales[Revenue] )

 

Cumulate Rev sum: = 
CALCULATE (
    SUM ( Sales[Revenue] ),
    WINDOW (
        1,
        ABS,
        0,
        REL,
        SUMMARIZE ( ALL ( Sales ), Category[Category], 'Calendar'[Date] ),
        ORDERBY ( 'Calendar'[Date], ASC ),
        ,
        PARTITIONBY ( Category[Category] )
    )
)

 

Category Rev total: = 
IF (
    NOT ISBLANK ( [Rev sum:] ),
    CALCULATE ( [Rev sum:], ALL ( 'Calendar'[Date] ) )
)

 

% cumulate rev: = 
VAR _cumulaterev =
    CALCULATE (
        SUM ( Sales[Revenue] ),
        WINDOW (
            1,
            ABS,
            0,
            REL,
            SUMMARIZE ( ALL ( Sales ), Category[Category], 'Calendar'[Date] ),
            ORDERBY ( 'Calendar'[Date], ASC ),
            ,
            PARTITIONBY ( Category[Category] )
        )
    )
VAR _categorytotalrev =
    CALCULATE (
        SUM ( Sales[Revenue] ),
        WINDOW (
            1,
            ABS,
            -1,
            ABS,
            SUMMARIZE ( ALL ( Sales ), Category[Category], 'Calendar'[Date] ),
            ORDERBY ( 'Calendar'[Date], ASC ),
            ,
            PARTITIONBY ( Category[Category] )
        )
    )
RETURN
    DIVIDE ( _cumulaterev, _categorytotalrev )

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Syndicated - Outbound

Hi Jihwan Kim,

Thank you for your reply, but when i try the dax function show some error. can you pls help me to figure out. 

AllanBerces_0-1707448050619.pngAllanBerces_1-1707448204216.png

 

Syndicated - Outbound

Hi,

Thank you for your message. I can see that there is many-to-many relationship. If many-to-many relationship is not avoidable, the approach has to be done in a different way.

Please share your sample pbix file, and then I can try to look into it.

Thanks.

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Syndicated - Outbound

Thank you for the help i got the solution by creating Dummy table.

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)