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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
PeeJii
Frequent Visitor

Calculating distinct shares with Date Table?

Hi,

 

I need to get distinct share of Orders that fit the selected time frame. I have date filter linked to date table with dates.

This gives me The Total rows:

PeeJii_1-1676887778756.png

And this one gives me ones with order:

PeeJii_2-1676887882385.png

 

So the share is this

Share = Calculate([Distinct_Suunnittelytyo_ROWS] / [Distinct_ROWS])

 

It does not take selected time frame in the count though.  

 

I wish I could you this as a filter -> OsuusAikaJaksolleLuotu = 1

PeeJii_0-1676887472742.png

I just don't know how combine all these. Page consist of three different graph all filtered with different time filter so a page level filter is out of the question.

 

So I'm looking for a card with share that changes with date slicer. Anyone?

 

Cheers

 

PeeJii

1 ACCEPTED SOLUTION

I found a solution. This is how I get desired result:

PeeJii_0-1677480008274.png

 

 

 

 

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @PeeJii,

I think you need to use the unconnected data table as source of filter/slicer, then you can try or use following measure to calculate the result based on filter selection:

formula =
VAR selection =
    ALLSELECTED ( DateTable[Date] )
RETURN
    CALCULATE (
        DIVIDE (
            DISTINCTCOUNT ( Table[ID] ),
            CALCULATE ( DISTINCTCOUNT ( Table[ID] ), Table[Status] = 1 )
        ),
        FILTER ( ALLSELECTED ( Table ), Table[Date] IN selection )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

formula = 
VAR selection =
    ALLSELECTED ( 'Dates (MOC)'[Date] )
RETURN
 CALCULATE (
   DIVIDE (
     DISTINCTCOUNT ( 'MOC Dokumentit'[MF ID] ),
     CALCULATE ( DISTINCTCOUNT ( 'MOC Dokumentit'[MF ID] ), 'MOC Dokumentit'[On Tilaus] = 1 )
     ),
        FILTER ( ALLSELECTED ( 'MOC Dokumentit' ), 'MOC Dokumentit'[Luotu] IN selection )
    )

Thanks. I tried yours, but don't get the right number. To me the measure looks right.

Hi @PeeJii,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

I found a solution. This is how I get desired result:

PeeJii_0-1677480008274.png

 

 

 

 

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 Kudoed Authors