cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PeterBI Regular Visitor
Regular Visitor

Creating and Using Measures in this Example

Hello,

 

I just started with PowerBI and need a little Help in creating measures and using it in a view.

I have the following Table with a relation to the datekey Table and the Idea for the view.

 

So my first question is the creation of the measure to calculate the WinnerQuote and the second question is using it to calculate the view for the weekly and the monthly numbers.

 

Thanks for an Idea for the Solution,

Peter

 

PBIX File

Excel File

 

 

2017-08-30_175300.png2017-08-30_174719.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Creating and Using Measures in this Example

Hi @PeterBI,

 

First of all I just complicated the measure a lot just use this and it works perfectly good:

WinnerQuote =
DIVIDE (
    CALCULATE ( COUNT ( Winner[Winner] ), Winner[Winner] = 1 ),
    CALCULATE ( COUNT ( Winner[Winner] ) )
)

Just being hard because of a different problem I had before.

 

Regarding the setup of the table here is the full menu copy:

Table_setup_1.pngTable_Setup.png

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




7 REPLIES 7
Super User
Super User

Re: Creating and Using Measures in this Example

Hi @PeterBI,

 

First of all don't know if your example in the Excel is based on the values you have in your PBIX file but add this measure:

 

WinnerQuote =
VAR WeekValue =
    MIN ( DateKey[Week] )
RETURN
    IF (
        MAX ( DateKey[Week] ) = WeekValue,
        DIVIDE (
            CALCULATE ( COUNT ( Winner[Winner] ), Winner[Winner] = 1 ),
            CALCULATE ( COUNT ( Winner[Winner] ), DateKey[Week] = WeekValue )
        ),
        DIVIDE (
            CALCULATE ( COUNT ( Winner[Winner] ), Winner[Winner] = 1 ),
            CALCULATE ( COUNT ( Winner[Winner] ), DateKey[Week] = DateKey[Week] )
        )
    )

 

The result is as follow:

 

 

Winnerquote.png

 

regards,

MFelix

 



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




PeterBI Regular Visitor
Regular Visitor

Re: Creating and Using Measures in this Example

Hi MFelix,

 

Thank You Very much. Is it possible to post a screenshot from the Visu Menue where you configure the Table?

 

Kind Regards

Peter

Super User
Super User

Re: Creating and Using Measures in this Example

Hi @PeterBI,

 

First of all I just complicated the measure a lot just use this and it works perfectly good:

WinnerQuote =
DIVIDE (
    CALCULATE ( COUNT ( Winner[Winner] ), Winner[Winner] = 1 ),
    CALCULATE ( COUNT ( Winner[Winner] ) )
)

Just being hard because of a different problem I had before.

 

Regarding the setup of the table here is the full menu copy:

Table_setup_1.pngTable_Setup.png

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




PeterBI Regular Visitor
Regular Visitor

Re: Creating and Using Measures in this Example

Hi MFelix,

 

Thanks again. I'm using this example to learn DAX so please excuse the next question, if it is so simple ;-)

 

Where do you get the Values? Are there aditionally measures? Can you send me the PBIX File?

2017-08-31_213557.png

 

Kind Regards

Peter

 

 

Highlighted
Super User
Super User

Re: Creating and Using Measures in this Example

Hi @PeterBI,

 

The values are all of the columns in your file however I have used the summarized options and also made the change of one of the columns:

 

Number of trades = Count of Winner - rename it (double click on the Values field)

Winner count = Sum of Winner - rename it (double click on the Values field)

Winner Quote = Measure created

Revenue = Sum of Revenue

 

Here is the PBIX file updated.

 

Any questions please feel free to send a message.

 

Regards,

MFelix

 



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




PeterBI Regular Visitor
Regular Visitor

Re: Creating and Using Measures in this Example

Hi MFelix,

 

first of all "Thank You Very Much"

It is an elegant Measure and you helped me in understanding Measures and using them.

I recreated in another Dataset and it worked very well. Its my first Pivot Table and every new Beginning is hard.

 

One small Question: In your Table you have Year, Month Number and Week next to each other.

2017-09-01 17-30-07.png

My Table shows only one of them and the Drilldown changes only the Value:

2017-09-01 17-33-05.png2017-09-01 17-34-41.png

 

Is there a hidden Setting?

 

Kind Regards

Peter

Super User
Super User

Re: Creating and Using Measures in this Example

Hi @PeterBI,

 

In the options on the Row Header you need to tick off the Stepped layout and click the last button on the drill down the two linked arrows on the right, then you will get that view.

 

T.png

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 6 members 2,420 guests
Please welcome our newest community members: